Skip to Main Content

How to use the code module on Divi Builder

Divi: the easiest WordPress theme to use

Divi: The best WordPress theme of all time!

With over 600.000 downloads, Divi is the most popular WordPress theme in the world. It is complete, easy to use and comes with more than 62 free templates. [Recommended]

The code module is a blank canvas that allows you to add code to your page, such as short plugin codes or static HTML code. If you want to use a third-party plugin, such as a third-party slider plugin, you can simply put the plugin's shortcode in a standard or full-width code module to display the element without hindrance.

How to add a code module to your page

Before you can add a code module to your page, you must first access the Divi Builder. Once the Divi theme is installed on your website, you will notice a button Use Divi Builder above the publisher each time you create a new page.

Clicking this button activates Divi Builder, which gives you access to all Divi Builder modules. Then click on the button Use Visual Builder to start the generator in visual mode.

You can also click on the button Use Visual Builder when you are browsing your upstream website if you are logged in to your WordPress dashboard.

button divi builder module blog divi

Once entered in Visual Builder, you can click the gray plus button to add a new module to your page. New modules can only be added inside the lines. If you start a new page, do not forget to add a line to your page first.

Locate the code module in the list of modules and click on it to add it to your page. The list of modules is searchable, which means that you can also enter the word "code" and then press Enter to search and automatically add the code module! Once the module is added, you will be welcomed with the list of options of the module. These options are separated into three main groups: Contents , Design et Advanced .

Use case by adding a dull style sheet to animate content on an individual page

In this example, I'm going to add a link script to import Animate.css to add animation effects to the page elements. Since the Animate.css file contains a lot of code, it makes sense to load it only on the page I need.

Easily create your website with Elementor

Elementor allows you to easily create any website design with a professional look. Stop paying expensive for what you can do yourself. [Free]

Just add a regular section and a full-width line (1 column) and add the code module.

In the content text box, add the code snippet.

All you have to do is add a few CSS classes to animate any element of your CSS class page on your page. In this example, I will bounce the button when the page loads.

In the Button module settings, on the Advanced tab, enter the two "animated" and "bounce" classes in the CSS Class text box.

Are you looking for the best WordPress themes and plugins?

Download the best plugins and WordPress themes on Envato and easily create your website. Already more than 49.720.000 downloads. [EXCLUSIVE]

Now the button bounces when the page loads.

Tip: Sometimes adding code with line breaks will prevent the code from working. It is best to create your code in a text editor and paste it into the code module.

Code content options

In the content tab, you will find all the content elements of the module, such as text, images and icons. All that controls what appears in your module will always be in this tab.


You can place any HTML, CSS, or JavaScript code that you want to display on the page at the current location. Only editors and administrators are allowed to publish unfiltered HTML, which means that code can be removed from the module if it is used by an author or collaborator. You can also place short codes in the module. These shortcodes will be displayed inside the parent column without any additional Divi module wrappers.

Administration Label

This will change the module label in the generator for easy identification. When using the WireFrame view in Visual Builder, these labels will appear in the module block of the Divi Builder interface.

Code design options

On the Design tab, you'll find all the module's style options, such as fonts, colors, size, and spacing. This tab allows you to change the appearance of your module. Each Divi module has a long list of design parameters that you can use to edit just about anything.

Maximum width

Any value entered here limits the width of any content rendered in the code module to the set value. For example, entering 50% in the input field will reduce the contents of the code module to 50% of the column that contains it.

Code Advanced Options Code

In the Advanced tab, you'll find options that more experienced web designers can find useful, such as custom CSS and HTML attributes. Here you can apply a custom CSS to one of the many elements of the module. You can also apply custom classes and CSS IDs to the module, which can be used to customize the module in the style.css file of your child theme.


Enter an easy-to-use CSS ID for this module. An identifier can be used to create a custom CSS style or to create links to particular sections of your page.

Easily create your Online Store

Download free WooCommerce, the best e-commerce plugins to sell your physical and digital products on WordPress. [Recommended]

CSS class

Enter the optional CSS classes to use for this module. A CSS class can be used to create a custom CSS style. You can add multiple classes, separated by a space. These classes can be used in your Divi Child theme or in the custom CSS that you add to your page or website using Divi theme options or Divi Builder page settings.

Custom CSS

A custom CSS can also be applied to the module and to one of the internal elements of the module. In the custom CSS section, you will find a text field where you can add CSS directly to each element. The CSS entries in these settings are already embedded in style tags. You only need to enter CSS rules separated by semicolons.


This option allows you to control the devices on which your module appears. You can choose to disable your module on tablets, smart phones or desktops individually. This is useful if you want to use different modules on different devices or if you want to simplify mobile design by eliminating certain elements of the page.

That's it for this tutorial.

This article features 0 comments

Leave a comment

Your email address will not be published. Required fields are marked with *

This site uses Akismet to reduce unwanted. Learn more about how your comments data is used.

Back To Top