Make Divi Pop With Cool Highlights!
I’m sure you know by now that I love playing around with CSS. I have hundreds and hundreds of snippets that I use on clients sites, and gradually I am shareing them with you here on the blog. This week, I’m going to show you how to add text highlights in Divi. I have noticed these are becoming quite the trend in web design, so I wanted to show you wonderful folks how to get on board with them. I included four styles in this tutorial, but if you have more ideas please let me know.
Join subscribers on our YouTube channel and enjoy other Divi video tutorials!
1. Multi-Line Text With Color Background Around Each Line
The first example of text highlights in Divi is my favorite and is fairly popular on modern websites. To create a multi-line colored background highlight like this, just add a CSS class inside the module’s Advanced Tab Custom CSS input area. In this example, we are using the class “pa-multi-line-highlight.”
Note that we are using this with an H2 in this example, so just change the H2 in your snippet to whatever you need such as H1, p, span, etc. Copy and paste one of your choice into your website.
Where To Paste The CSS Code
1. Divi Assistant
If you are using our Divi Assistant plugin, simply paste the code in the CSS tab in the custom code window in the Divi Visual Builder.
2. Child Theme
If you are using a child theme, paste this code into the style.css file. If you don't have a child theme, you can generate a child theme directly on your site or download our free child theme.
3. Divi Theme Options Integration
Otherwise, paste this code in your Divi>Theme Options>Custom CSS code box.
If you need help understanding where to paste the code, please check out our complete guide about where to add custom code In Divi.
.pa-multi-line-highlight h2 {
color: #ffffff;
background-color: #e03574;
line-height: 1.7em;
padding-bottom: 0px;
display: inline;
box-shadow: 10px 0 0px 0px #e03574, -10px 0 0px 0px #e03574;
box-decoration-break: clone;
}
2. Text CalloutEXAMPLE!
This text callout is great for highlighitn important things in your text, such as a notice, warning, or just as a fun accent. For this one, we need to specify which word or words we want to be highlighted using <span> tags. You can add these text highlights and accents in any Divi heading or text.
WARNING!This is very important! Just kidding, but I got your attention! Do you like this? Leave a comment if you think it’s cool!
To create a callout like this, just add a CSS class inside an HTML span tag. In these examples, we are using the class “callout” and “callout-2” so that each one can have a different color or spacing. You can copy the snippet below and then change the word “EXAMPLE” which is between the opening and closing span tags.
<span class="pa-callout">EXAMPLE!</span>
There are two code snippets below, one for each of the examples. Copy and paste one of your choice into your website.
Where To Paste The CSS Code
1. Divi Assistant
If you are using our Divi Assistant plugin, simply paste the code in the CSS tab in the custom code window in the Divi Visual Builder.
2. Child Theme
If you are using a child theme, paste this code into the style.css file. If you don't have a child theme, you can generate a child theme directly on your site or download our free child theme.
3. Divi Theme Options Integration
Otherwise, paste this code in your Divi>Theme Options>Custom CSS code box.
If you need help understanding where to paste the code, please check out our complete guide about where to add custom code In Divi.
/*text callout 1*/
.pa-callout {
position: relative;
color: #ffffff;
background-color: #2cba6c;
font-size: inherit;
padding: .2em .4em;
border-radius: 6px;
margin: 0 6px;
}
/*text callout 2*/
.pa-callout-2 {
position: relative;
color: #ffffff;
background-color: #e03574;
font-size: inherit;
padding: .2em .4em;
border-radius: 6px;
margin: 0 6px 0 0;
font-weight: bold;
}
3. Color Highlights In Text
This text callout is great for highlighting important things in your text, such as a notice, warning, or just as a fun accent. For this one, we need to specify which word or words we want to be highlighted using <span> tags. You can add these text highlights and accents in any Divi heading or text.
To create a color highlight like this, just add a CSS class inside an HTML span tag. In this example, we are using the class “pa-color-highlight.” You can copy the snippet below and then change the word “EXAMPLE” which is between the opening and closing span tags.
<span class="pa-color-highlight">EXAMPLE!</span>
Copy and paste this code snippet into your website.
Where To Paste The CSS Code
1. Divi Assistant
If you are using our Divi Assistant plugin, simply paste the code in the CSS tab in the custom code window in the Divi Visual Builder.
2. Child Theme
If you are using a child theme, paste this code into the style.css file. If you don't have a child theme, you can generate a child theme directly on your site or download our free child theme.
3. Divi Theme Options Integration
Otherwise, paste this code in your Divi>Theme Options>Custom CSS code box.
If you need help understanding where to paste the code, please check out our complete guide about where to add custom code In Divi.
/*color highlights in text*/
.pa-color-highlight {
text-decoration: none;
box-shadow: inset 0 -.5em 0 rgba(255,166,60,0.75);
color: inherit;
}
4. Highlight Around Bold Text
See what I did there? This was is pretty cool! Add the class “pa-bold-highlight” to any module that has bold text. Once you have the CSS snippet added to your page or website, the bold text will instantly have a yellow highlight color around it. Of course, you can always change the color and opacity of the highlight.

Go ahead and copy and paste the CSS snippet into the Divi>Theme Options>Custom CSS box. (I added the “h2 strong” so that you could visually see it above, but you can remove that from the snippet.)
/*add highlight around bold text*/
.pa-bold-highlight p strong, h2 strong {
padding: 0 5px;
background-color: rgba(255,255,0,0.5);
}
Highlighted Text In General
In the comments nordie pointed out a trick to highlight text in general. This is different than what I was doing here with the bold text, but if you just want highlights, this works great!
<mark>Your highlighted text here</mark>
Cool tips! So simple and good looking. Thanks Nelson 🙂
Hey Samson, glad you like these! You are welcome! 🙂
Color highlights in text!
Hi, how do I change the color on number 3 from orange to #E8ADAA?
Thank you for these tips!
Hey Robyn,
To change the color just replace rgba(255,166,60,0.75) with your color. I used an rgb color there because it is 75% opacity, but your hex color will work perfectly too!
Thank you so much! Still learning all this stuff! Happy holidays.
Hello… great blog. I used a different hex color and changed to .6 height… and it just keeps changing back to the original… have you seen this before?
Hi Mel,
I don’t think any my snippets have a height, so I’m not sure what you mean without more context.
Cool Nelson !!!!!. Thank´s again.
Guillermo
Hey Guillermo,
You are welcome! Glad you found this helpful! 🙂
Thank you, Nelson. I am learning a lot from you here. I am so appreciative.
You are welcome, Charles! Glad you can learn a lot here! 🙂
Hello my friend, so nice, thank you!
Unfortunately, I have a problem that I can’t see the highlights on my mobile device (I can’t see it even if reduce the chrome browser here on my computer to the smaller window.) Can you advise me what I’m doing wrong? Thank you!
Hi Peter, that’s pretty strange. Can you share the link so I can see?
Super useful tips. Thank you so much!
You’re welcome Ezinne, glad you enjoyed these!
Hi,
I try to do this but I cant do. I use in Gutenberg editor. <span class=“pa-color-highlight”>EXAMPLE!</span> in html but not work
I don’t see anything wrong with that code, should work whether it’s Divi or Gutenberg because it is just HTML.
Very useful, thanks Nelson!
You are welcome, Lydia!
Thanks for the tips!
But I would like to use different colors in case number 3, not only one, I mean in different texts, for example one text with #fbf7ef and another with #eefeee. How can I do that?
You’re welcome, Paula! And I do that all the time, just duplicate the code and add some variation to the class like “.pa-color-highlight-red” and just have one for each color and use the matching class in the span tag.
Thanks!! It worked! Looks amazing!
That’s great, feel free to customize it even more with color and size!
Great tips! Thank you 🙂
You’re welcome, Alex! Glad you like them!
Thank you for this it’s grat. But one question How do you apply this to Meta info
Hi Chadi,
Which one (number) are you thinking of adding to meta? Do you mean on the blog module, or somewhere else?
I am using this on blog titels, and I would like to extend this to the meta info under the title. Such as the date and the category and author info. Is there a way to do that as a hole, or do I have to put a seperate css for the meta.
The meta has a css class already, offhand I think .post-meta or something similar. So however you are targeting the title, do similar for this.
Thank you very much for the tip, they worked great. I thought it would be easy to make a specific tweak, but I’m struggling. Is it possible to use the bold as a way of changing one link to another color? I thought maybe just taking out the ‘background’ of ‘background-color’ plus a million other variations I tried. I have somehow worked myself into a complex design solution that utilizes links as a way of having 2 different sized and coloured text in one running text box, but would like just one of them to start out in a different colour. Does that make sense?
Hi Brittany,
I’m afraid I’m a little confused. Do you have an example link to show me?
Excellent tutorial. How can I make that the text is centered in option number 1? It’s always justified to the left. Thanks!
Hi Francisco,
Our code is not centering anything…that would be set in the module 🙂
this also works
<mark>highlight</mark>
That’s awesome, I had no idea!
Cool tips however number one keeps coming up with an expected RBRACE error – can you help?
.pa-multi-line-highlight h2 {
EXPECTED RBRACE
color: #ffffff;
background-color: #e03574;
line-height: 1.7em;
padding-bottom: 0px;
display: inline;
box-shadow: 10px 0 0px 0px #e03574, -10px 0 0px 0px #e03574;
box-decoration-break: clone;
}
UNEXPECTED TOKEN ‘}’
Hi Emma,
That simply sounds like you are adding the CSS to the wrong place. Be sure to add the code to your Divi Theme Options Custom CSS or styl.css in a child theme.
i love it , thanks
Great, glad you love it!
Hi Nelson, thanks for your tips. I tried to work with No. 1 but want the text to align right. I have to lines of Text with some space in between. When I add align right to your code, I get a colored box without any space between the lines. Any ideas?
Hi Rolf,
I’m not sure what, I can’t visualize what you mean. Why not try aligning it right in the module settings?
Love this, thank you!
I was wondering if it is possible to have every H2 in blog posts have a colorful underline. I tried the following:
————————
In the Divi Builder, in the Post Content Settings I added to the CSS Class: pa-color-highlight
In the Divi Child theme CSS I added:
/*color highlights in text*/
.pa-color-highlight h2 {
text-decoration: none;
box-shadow: inset 0 -.5em 0 rgba(136,196,221,1);
color: inherit;
}
————————-
But, it didn’t work 🙁 Any ideas?
Please try adding a Custom Class to the Blog Module by going to the Blog Module Settings > Advanced > CSS ID & Classes and then add a Custom CSS by grabbing that Custom Class. For example, the custom class that you have given is pa-blog-module.
Then go to the WordPress Dashboard > Divi > Theme Options > Custom CSS Panel and place the code given below:
.pa-blog-module article .entry-title {
text-decoration: none;
box-shadow: inset 0 -.5em 0 rgba(136,196,221,1);
color: inherit;
}
This will highlight all the h2 tags in the blog post. Please let us know if it helps. 🙂
Thank you for the suggestion.
To make it work I still need to manually add the class to every h2 text
<span class=”pa-color-highlight”>TEXT</span>
In your code, where do you state h2?
.entry-title is the class that is given to all the h2 tags in the blog module. That is why I have suggested that code and it is working completely fine for me. Please try using the code given below and if that doesn’t help then please share the URL so that I could investigate further:
.pa-blog-module article .entry-title a{
text-decoration: none;
box-shadow: inset 0 -.5em 0 rgba(136,196,221,1);
color: inherit;
}
Please let me know how it goes.
hi thank you! What if the H2 has to lines, how can I break the underline to appear below the two lines? I found a solution with box-decoration clone, but it doesnt work! thank you!
Hey Patricia,
Could you please share the URL of the website for me to investigate further on this?
Thank you Nelson….I am wondering….what if you already have a span style….how would that look like….
Thanks,
Mark
If you already have a span tag and you want to highlight that then just give the class of your preferred style that is mentioned in the tutorial to the span tag and then paste the code in the Theme Options. You can change the color with the color that you want to give to your span. If you want to highlight the whole h1 then wrap that h1 tags in the span tags and then give that span a class mentioned above.
Hi Nelson, thanks for the post, it helps a lot.
I’m looking for a solution to move the text in the option 1 a bit above the background. The idea is to get 3 layout, 1 with a background image, the second with the text background, then the text itself.
I did some text with text transformation and background on colomn, then offset using x/y axis. It’s working, but it’s not responsive. I tried as well with a separator, still the same issue.
I guess I would have to use box shadow ? What do you think ?
Thanks,
Simon
Hi Simon
You need to use the Divi Responsive Functionality and set different offset values for different screens to make it responsive or else you can use the responsive units like vw, em, rem instead of pixels.
Let us know how it goes. 🙂
Hello, thanks a lot for this. I’ve seen the highlight effect on some sites and it is really cool. Should we use a child theme, so that the CSS on the page settings are retained with subsequent Divi theme updates? Also, what’s the best place to add the CSS – is it within the page settings or theme options/custom css?
Many thanks, I am new and still learning Divi, so any feedback greatly appreciated.
If your CSS Code will only going to affect the elements present on a single page then you can go ahead and add the CSS in the Page Settings as it will be the best place in this scenario. If the code will going to affect more than one page then the best place to paste the code is Theme Options > Custom CSS Panel as then you will not have to place the code more than once and it will retain after the theme updates. If you want to place the code in your child theme style.css so you can as this is also equally good as the Theme options.
I’m trying to get the color highlights (#3) to work and seem to be doing something wrong. I pasted the first snippet inside the CSS ID & Classes area and added the second snippet to the theme options. What am I missing?
You need to place the first snippet under the content tab in the body text of the Module of your choice. For example, if you want to use the Text Module then add the text module and go to the Text Module Settings > Content Tab > Text and there you will see a panel (in which the dummy content will be there by default), and in that you need to place the span tag snippet. After that to place the second snippet you need to go to the WordPress Dashboard > Divi > Theme Options > Custom CSS Panel and place the code there.
Please let us know if that helps.
How to add style 3 to link text.
In the style three, there is a span tag given. We can place the anchor tag between the span tags and provide the link to that anchor tag. Instead of just placing the span tag, place the snippet given below:
<span class=”pa-color-highlight”><a href=”Place your link here”>EXAMPLE LINK!</a></span>
Inside the href quotes, you need to place your link.
Hey Nelson
How to make the link text effect like your blog, underline and highlight on hover.
Place the span tag inside the text module and then place the anchor tags between the span tags to place the link as shown here: https://pasteboard.co/K4EBGvH.jpg
Provide the custom class to the span tag. In this case, the custom class that I have given is pa-underline.
After that go to the Divi > Theme Options > Custom CSS Panel and place the code given below:
span.pa-underline a{
text-decoration: underline;
text-decoration-color: #d2007f;
transition: all 0.2s ease-in-out;
font-weight: bold;
}
span.pa-underline a:hover{
color: #fff;
background-color: #d2007f;
}
You can change the line color and the background color by changing the color value in the text-decoration-color and background-color property.
this blog is one of the best things that have ever happened to my life.
true story. if you come to South America shoot me an email! You’re so welcome!
I love hearing things like that, so happy to help!
Hello,
This is what I’m looking for! Thank you! but I got some problem…
When I copy and paste the first one (Multi-Line Text With Color Background Around Each Line) to Custom CSS section, it will said “Expected RBRACE.” and “Unexpected token ‘}’.” I paste in the “Main Element” section in the Custom CSS.
How can I fix this?
Thank you!!
Hi Catherine,
That’s actually not the correct place for code, you should go to Divi>Theme Options in the backend and scroll down and paste it there in the Custom CSS box.
Very cool. Thanks for sharing 🙂
You’re welcome, glad you like it!
Hi Nelson,
I tried the multi-line highlight and it works so far. I only have my text right aligned and with your code it is on the left. How could I have my text on the right?
Thanks again for sharing this. Very helpful.
Sophie
Hey Sophie,
I have checked the URL you provided and I am afraid that I am not able to find where you are facing the issue exactly. Could you please point me in the right direction so that I could help?
Hi,
I have a question to No. 2 (Text Callout). If I highlight multiple lines only the beginning and the ending of the text is rounded. (The row breaks are flat) What CSS do I have to add to make the corners rounded at the beginning and end of each row of the highlighted text?
Hey Aron,
Could you please share the URL for me to investigate it further?
Great article! Thanks for sharing.
for highlighted body text in general, and using this:
Your highlighted text here
How do I change the color of the highlight?
Thank you!
The color can be changed by the hex value…I’m not sure how else to answer that.
Hi thanks for this!! I love these effects. I have a quick question: In the ‘.pa-multi-line-highlight ‘ example how would you make the text align centered? ‘text-align: center;’ doesn’t seem to do it. I’m going to keep digging around but any suggestion you have would be super helpful and appreciated! This is what I’ve got so far:
.highlight h1 {
color: #00303f;
background-color: #FBC816;
line-height: 1.6em;
font-weight: 700;
text-align: center;
padding-bottom: 0px;
display: inline;
box-shadow: 20px 0 0px 0px #FBC816, -30px 0 0px 0px #FBC816;
box-decoration-break: clone;
}
Hey Dawna,
I have investigated the website and the text is already aligned in the center. If you can’t see the results then, please check the website in incognito mode and see if that helps.
Hey! This has worked great for me in the past but I’m now getting a rogue line where it shouldn’t be. Have you seen this before?
Hey Luke,
Could you please share the valid link so I can investigate the issue?
Hiya – I’ve been using the text highlight #1 on a site (and it was working perfectly before…so thanks). However, I’ve just noticed that the box-shadow stopped working for the “h1” text but is absolutely fine on “p”. The same seems to have happened in your written tutorial above i.e. no box shadow to the left & right of your highlighted text (even though it’s clear in the video version). There’s also a warning against “box-decoration-break: clone;”
Any suggestions on how to get this working again?
Cheers
Hi James!
Could you please share the URL of the page for me so I can check it?
If you are using the 1st option, please make sure you have replaced “h2” with “h1” in the given code.
For the box shadow, please adjust the box-shadow value as per your requirement in the given code above. For example:
https://prnt.sc/hRshru16RqJW
Regarding the warning message, please make sure all the code is added correctly. I have checked the code and it’s working fine. Please check the screenshot below:
https://prnt.sc/bsbFF1x-cx5c
Hi, this is exactly the effect I was looking for ! Would you have any idea how to do the same for the Post Title module to have the highlight effect on the title of a blog post ?
The best way to handle that is to use this tutorial: https://www.peeayecreative.com/how-to-change-the-divi-post-archive-title-to-an-h1-heading/ and add the CSS span in the before pseudo class.
Hi!!
thank you for the great tutorial. but i have the problem that it doesn’t work in mobile. could you help me? Please?
http://www.acreativa.be
Hi Caroline!
I can see you’re using the text callout. I have checked and the mobile version looks good. Please try clearing the browser cache and see if it helps.
Love these concepts, but can’t get #3 to work at all – all steps followed but it just doesn’t do anything – what am I missing.
Hi Emma!
Could you please share the URL of the page for me so I can check it?