The Code Module Divi is a blank canvas that allows you to add code to your pages, such as plugin shortcodes or static HTML code. If you want to use a third-party plugin, for example, a third-party slider plugin, you can simply place the plugin’s shortcode in a standard or fullwidth code module to display the element unfettered.
How to add a code module divi to your page
Before you can add a code module divi to your page, you must first access the Divi Builder. Once the Divi theme is installed on your website, you will notice a Use Divi Builder button above the post editor every time you create a new page.
By clicking on this button, you activate Divi Builder, which gives you access to all the Divi Builder modules. Then click on the Use Visual Builder button to launch the builder in visual mode.
You can also click the Use Visual Builder button while browsing your upstream website if you are logged in to your WordPress dashboard.
Once entered into Visual Builder, you can click the gray plus button to add a new module to your page. New modules can only be added inside rows. If you are starting a new page, remember to add a row to your page first.
Locate the code module divi in the list of modules and click on it to add it to your page. The list of modules is searchable, which means you can also type the word “code” and then hit enter to automatically find and add the code module divi! Once the module is added, you will be greeted with the list of module options. These options are separated into three main groups: Content, Design, and Advanced.
Use case by adding a dull stylesheet to animate content on an individual page
In this example, I will add a link script to import Animate.css to add animation effects to the elements on the page. Since the Animate.css file contains a lot of code, it makes sense to only load it on the page that I need.
Just add a regular section and full-width row (1 column) and add the code module divi.
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’m going to bounce the button when the page loads.
In the Button module settings, on the Advanced tab, enter the two classes “animated” and “bounce” in the CSS class text box.
Now the button bounces when the page loads.
Tip: Sometimes adding code with line breaks will cause the code to stop working. It is best to create your code in a text editor and paste it into the code module divi.
Code module divi content options
In the content tab, you will find all the content elements of the module, such as text, images, and icons. Everything that controls what appears in your module will always be in this tab.
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 module divi design options
In the Design tab, you will find all the styling options for the module, such as fonts, colors, size, and spacing. This tab allows you to modify the appearance of your module. Each Divi module has a long list of design settings that you can use to tweak just about anything.
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.
Read more: How to create buttons with icons on Divi
Advanced options of the Code module
On the Advanced tab, you’ll find options that more experienced web designers may find useful, such as custom CSS and HTML attributes. Here you can apply custom CSS to any of the module’s many elements. You can also apply custom CSS classes and IDs to the module, which can be used to customize the module in your child theme’s style.css file.
Enter an easy-to-use CSS ID for this module. An ID can be used to create a custom CSS style or to link to particular sections of your page.
Enter the optional CSS classes to use for this module. A CSS class can be used to create custom CSS styling. 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 the Divi theme options or the Divi Builder page settings.
Custom CSS can also be applied to the module and any of the module’s internal elements. In the Custom CSS section, you will find a text field where you can add CSS directly to each element. CSS entries in these settings are already embedded with style tags. You just 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 deactivate your module on tablets, smartphones, or desktops individually. This is useful if you want to use different mods on different devices or if you want to simplify the mobile design by removing some elements from the page.
For website maintenance service contact us.