Change Text and Heading Background Colors in Divi Using CSS

July 25, 2025

One limitation of the Divi theme is that some elements in the design modules and Theme Builder for posts don’t offer options to change the background color of text and headings. That’s why using custom CSS is the best solution in these cases.

Step 1: Add a CSS Class

In the Advanced tab under Custom CSS, add the following CSS class:

pa-multi-line-highlight
Step 1: Add a CSS Class | Change Text and Heading Background Colors in Divi Using CSS

Step 2: Add Custom CSS Code

In the main Divi tab, go to Theme Options and paste the following code:

.pa-multi-line-highlight h2, h3 {
  color: #ffb300;
  background-color: black;
  line-height: 1.7em;
  padding-bottom: 0px;
  display: inline;
  box-shadow: 10px 0 0px 0px black, -10px 0 0px 0px black;
  box-decoration-break: clone;
}
Step 2: Add Custom CSS Code | Change Text and Heading Background Colors in Divi Using CSS

Note (for those who aren’t familiar with CSS — like myself):

  • H2H3H1pspan, etc. are the elements you want to apply background color or highlights to.
  • color: changes the text color.
  • background-color: changes the background color of the text.
  • box-shadow: also needs to match your background color, as it controls the highlight border effect.

Step 3: Result

Change Text and Heading Background Colors in Divi Using CSS
Đánh Giá Bài Viết

Driven by knowledge. Passing on what I've learned.

No Results Found

The page you requested could not be found. Try refining your search, or use the navigation above to locate the post.