4 Ways to Add CSS to Divi

by | Jan 5, 2022 | Divi Tutorials

One of the most remarkable aspects of using the Divi theme is the breadth of its choices. From using the front end or back end builder to modifying modules with a variety of options, Divi is simply a theme that responds to a wide range of users by allowing for deep degrees of customization in an intuitive and accessible manner.

Extending on this idea, Divi users are not constrained in terms of CSS styling.

Along with the standard stylesheet included with almost all WordPress themes, Divi users are fortunate to be able to enter CSS in a variety of locations, six to be exact!

We’ll examine the numerous options for adding custom CSS to your Divi theme in the following blog article, as well as the advantages and disadvantages of each method.

Please keep in mind that, at the time of writing, Elegant Themes had just released a sneak preview of one of the upcoming Divi theme upgrades, which included the addition of format-friendly Custom CSS boxes to the Divi Theme Options boxes. If, by the time you read this, the update has been applied and you are developing CSS within the Divi framework that mimics the formatting of a text editor or integrated development environment, please disregard the areas where I discuss the lack of formatting.

Four Different Methods for Including CSS in Divi

Divi users can add custom CSS to their websites in five different ways. Among these techniques are the following:

  1. Inline CSS is added to the content section of a module.
  2. Custom CSS Box in the Divi Theme Options Dashboard.
  3. The Advanced options tab of the sections, rows, and individual modules.
  4. Add CSS with the WordPress plugins.

1. Inline CSS added to the content section of a module

Any module within the Divi theme that has a content area (i.e. a place where you can enter custom text, such as the text module, blurb module etc.) will allow you to add inline styles. To add inline styles to a section of an element, you’ll require to target the element itself and add the <style> attribute, thereafter you can add any number of styling properties that relate to the specific element you’re trying to target and style.

To add inline CSS to a module in the Divi Builder (provided it has a content area), open the WYSIWYG Text editor, not the WYSIWYG Visual editor.

Next is to assign a tag to the element (in this case, we’ll assign a <p> tag to make it paragraph text and apply the <style> attribute. Once the style tag is added, you can add various properties and values.

2. Add Styling to Divi Using the Divi Theme Options Custom CSS

A popular way to add CSS to Divi is by using the Custom CSS box in the Divi Theme Options dashboard. To locate the Custom CSS box navigate to Divi > Theme Options and scroll all the way down the page until you see the Custom CSS box.

Unlike code editors (such as Sublime or Brackets), the Divi Theme Options Custom CSS box does not include any colour-coding or automatic script guidelines so be sure to pay attention when entering CSS here.

For the next example, we’ll take the second text module in our four-column layout. We’ll take the second text module’s paragraph text and style it by increasing the font and changing the colour.

If you know exactly which element you are targeting, you can enter the CSS directly into the text area. To find the exact property that you may require to target, you can open the specific Divi module, navigate to the Advanced tab and click in the Main Element area. The name of the property will automatically pop up just above the text area.

Simply copy that selector, head over to the Divi Theme Options Custom CSS box, paste in the selector’s name and add the desired styling. Do not forget to click Save Changes.

3. Add Styling to Individual Divi Modules Using the Advanced Tab CSS

The next place that you can add CSS is in the Advanced Tab section of the individual module, row or section

First, let’s cover the individual modules Advanced options. Within the module’s Advanced tab, you’ll find:

  • CSS ID & Classes: Here you can enter unique class or ID names that can be used to add even more layers of unique styling
  • Custom CSS: Composed of the before, main element and after boxes. The before and after areas are for pseudo-elements, to add additional elements either before or after the content. The main content box is where the styling of the specific module should go.
  • Visibility: Here you can decide whether the module should be hidden or shown on various devices

Note, each module in the Divi builder is composed of different elements and so will present a different set of options in the Advanced tab.

To add CSS to the individual module, open up the module itself by clicking on the hamburger menu, navigate to the Advanced tab and scroll down until you see the Main Element box. Here, add the various CSS styling, but note, you only have to enter the property and the value – you do not may require to specify the selector.

You can do this for every section, row and module.

Adding CSS into the modules and rows can be useful for quick, simple edits, but beyond small changes that are going to stay the same forever, adding CSS this way isn’t really recommended. If you’re going to be working on a website regularly, changing up the aesthetic or adding new content, using the module or row CSS may present a few problems down the line as trying to keep track of hundreds of lines of CSS entered into various modules scattered across a website can be confusing.

4. Add CSS with WordPress plugins

Plugins are a great way to add CSS because they do not require any special coding. Simply install a WordPress plugin and you can start adding your CSS. There are lots of good options available in both free and premium versions. Here’s a look at a few of the best options.

Simple Custom CSS and JS

Simple Custom CSS and JS is a free plugin that adds an editor to any WordPress theme to make it easy to add CSS and JS. The editor adds syntax highlighting to make it easier to follow. Add the CSS on the frontend or backend.

Once you have created your code you can print it inline, add it to an external file, print it to the header or print it to the footer. The code is cached within your files so they do not have to load from the server every time the page loads.

pro version is available that adds even more features such as Less and SAAS preprocessors, editor themes, the ability to choose specific URLs to display the code and more.

  • 1 site – $48.50
  • 10 sites – $68.50
  • 50 sites – $148.50

SiteOrigin CSS

SiteOrigin CSS is a free CSS editor that works with any WordPress theme. It includes visual controls to make editing even easier and you can see the results in real-time. Choose colours, styles and measurements with the click of a button.

It has a lot of help for writing CSS. Click on any element and it will identify the best selector to use. The code auto-completion feature for selectors and attributes makes writing CSS faster. It also has tools to identify issues with your code before it’s published.

The Bottom Line

There are many ways to add custom CSS to the Divi theme, the trick is to find the method that feels the most comfortable and suits your Divi design habits the best.

If you decide to add CSS to the modules, pages or content areas as inline CSS, we recommend possibly keeping a note of this so that if and when you return to a website, you don’t spend hours trying to figure out where certain CSS is being served from.

How do you add CSS styling to your Divi website? Which is your favourite and also least favourite method? Please feel free to share your comments or questions below. We love receiving your feedback!

Latest Posts

Overview of the WordPress Interactivity API

Overview of the WordPress Interactivity API

The WordPress Interactivity API is a groundbreaking feature introduced in WordPress 6.5, designed to simplify and standardize the process of adding interactive elements to WordPress websites. This comprehensive guide will walk you through what the Interactivity API...

Power Of Gutenberg And Its Plug-ins For Enhanced Content Creation

Power Of Gutenberg And Its Plug-ins For Enhanced Content Creation

In the ever changing landscape of website development, there are several frameworks and runtime environments available for creating and testing websites. PHP, HTML, Node.js etc. WordPress is a popular CMS that has built an ecosystem around it to make web development...

How Do I Earn Money From Reseller Hosting? The Major Benefits

How Do I Earn Money From Reseller Hosting? The Major Benefits

Do you have the dream of building your own web hosting company? Of course, you might have. However, you may have concerns about building your web hosting company from scratch. Thus, reseller hosting services come into existence. In reseller hosting, you are able to...

Dedicated Hosting: The Key To Optimal Performance And Scalability

Dedicated Hosting: The Key To Optimal Performance And Scalability

In the web hosting world, dedicated hosting emerges as an alternative, offering customers an isolated, robust, and scalable hosting environment. As business owners and individuals are looking to enhance their online visibility and ensure the seamless working of their...

Contributor Day Registration For WordCamp Asia 2024

Contributor Day Registration For WordCamp Asia 2024

Greetings WordPress enthusiasts! As we gear up for the highly anticipated WordCamp Asia 2024, we are thrilled to share exciting news about a pivotal event that promises to elevate your WordPress experience – Contributor Day. Mark your calendars for March 7, 2024, at...

Our Founder Mayank is speaking at WordCamp Udaipur 2023

Our Founder Mayank is speaking at WordCamp Udaipur 2023

Who is Mayank? Mayank Kumar has been a WordPress enthusiast since he first used WordPress in 2020 when he was just 17 years old. Mayank is a 20-year-old Computer Science Geek who loves WordPress so much. He is been running a Web Agency and two Ed-tech...

How To Change Twitter Icon To X in Divi Theme

How To Change Twitter Icon To X in Divi Theme

As everyone knows, Twitter has changed its name to X. Websites and tools like Divi will definitely need some time to catch up, so I wanted to provide you with some quick instructions now so that those who wish to make changes can do so before it gets updated later in...

WordPress Dashboard – Comments

WordPress Dashboard – Comments

In the Comments Screen, you can edit or delete content found in comments to your posts, and you can mark comments as spam, send comments to the trash and reply to comments. A number of rules can be defined about who can write comments and how comments are...

WordPress Dashboard : Pages

WordPress Dashboard : Pages

The Pages Screen provides the facility to manage all the Pages in a blog. Via this Screen, Pages can be edited, deleted and viewed. Filtering and searching also make it easy to quickly find pages matching certain criteria. Several powerful features allow pages to be...

WordPress Dashboard : Media

WordPress Dashboard : Media

Media → Library Media consists of the images, video, recordings and files that you upload and use in your blog. Media is typically uploaded and inserted into the content when writing a Post or writing a Page. Note that the Uploading Setting in the Settings Media...

Latest Posts