Subscribe On YouTube

Join other subscribers and enjoy other Divi video tutorials!

How To Add Text Highlights, Accents, and Underlines in Divi

Nelson Miller Profile Orange
Here's a fun tutorial that will help you add several different styles of highlights, accents, and underlines to text in your Divi website. Enjoy!

▶️ Please watch the video above to get all the exciting details! 👆

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;
}
<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;
}
<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;
}
Change the Divi Gallery Image Aspect Ratio

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> 

Subscribe For More Things Like This!

At the start of each month, we send out a recap newsletter from the month before with family news, Divi news, our latest tutorials, and product news. Occasionally, if the news is too exciting to wait, we will send out another email separate from the monthly newsletter. That’s what you get when you subscribe, and of course you can unsubscribe if you are no longer interested!

Blog Post Optin
Divi Logo (2)

Shop Our Divi Products

Plugins • Courses • Templates

Visit The Shop

Featured Products

Asset 4

New! Trail Guides

Follow a series of blog posts carefully arranged around a specific topic or goal! Keep track of your progress by marking posts completed, just like a free course!

View Trial Guides

Divi Trail Committee Membership badge with map design

Join The Trail Committee!

Show support for our ongoing work creating community resources at Pee-Aye Creative and enjoy exclusive member perks in return.

Learn More

Divi Tutorials On YouTube

Our videos have views! Join subscribers and enjoy over video tutorials!

Visit Our Channel

Leave A Response!

By commenting you agree to our Blog & YouTube Comments Policy

94 Comments

Comments By Members

These comments are highlighted because they were posted by fans who have a membership on this site.

  1. Mark Hancock <span class="comment-author-role-label"><a href="https://www.peeayecreative.com/product/divi-adventure-club/" class="comment-author-role-link" rel="external nofollow" target="_blank">Divi Adventure Club Member</a></span>

    Thank you Nelson….I am wondering….what if you already have a span style….how would that look like….

    <h1>Quality Is What <span style="color: #70bd42;">KJE Aquatics</span> Has For You</h1>
    

    Thanks,
    Mark

    Reply
    • Hemant Gaba <span class="comment-author-role-label"><a href="https://www.peeayecreative.com/product/divi-adventure-club/" class="comment-author-role-link" rel="external nofollow" target="_blank">Divi Adventure Club Member</a></span>

      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.

      Reply

Comments By Others

  1. James

    How do I get this effect to look good when it breaks over two lines? Currently it could do with some padding.

    Reply
    • Hemant Gaba <span class="comment-author-role-label"><a href="https://www.peeayecreative.com/product/divi-adventure-club/" class="comment-author-role-link" rel="external nofollow" target="_blank">Divi Adventure Club Member</a></span>

      Hi James!

      You can decrease the font-size to align the text together. If it doesn’t work, please share the URL of the page.

      Reply
  2. Andrea

    Can I use multiple colours for the highlight? So 3 consecutive words would be highlighted in 3 different colours?

    Reply
    • Hemant Gaba <span class="comment-author-role-label"><a href="https://www.peeayecreative.com/product/divi-adventure-club/" class="comment-author-role-link" rel="external nofollow" target="_blank">Divi Adventure Club Member</a></span>

      Hi Andrea!

      In that case, you need to assign the text in different spans with different classes and use different color code CSS. Ex:

      Firstwordsecondword

      Then use the classes with different CSS.

      Reply
  3. Shannon

    Hi Nelson, thanks for the tips! I am using color highlight option #3 from your blog post and it works great. I wondered if there was a way to make this highlight animate in from left to right? that would look so cool! Thank you!

    Reply
    • Hemant Gaba <span class="comment-author-role-label"><a href="https://www.peeayecreative.com/product/divi-adventure-club/" class="comment-author-role-link" rel="external nofollow" target="_blank">Divi Adventure Club Member</a></span>

      Hi Shannon!

      Please try using the following code and see if it helps:

      .pa-multi-line-highlight h2 {
      bottom: 15%;
      position: absolute;
      -webkit-animation: linear;
      -webkit-animation-name: run;
      -webkit-animation-duration: 5s;
      }

      @-webkit-keyframes run {
      0% {
      left: 0;
      }
      50% {
      left: 50%;
      }
      100% {
      left: 100%;
      }
      }

      Also, you can use animation in module setting if needed for whole module.

      Reply
  4. Hannah

    Wow so helpful!
    Thank you so much for the tutorial and all your helpful tips 😀

    Reply
  5. Hannah

    Love the tutorial, so helpful! I’m trying to add a hand drawn underline element (a png) behind one word on a headline. I have a feeling I could use the span code to do that…. but I’m not sure how to code the image in the CSS. Am I on the right track? Any tips? Thanks!

    Reply
    • Nelson Lee Miller (aka The Divi Teacher) <span class="comment-author-role-label author-label">Author</span>

      Sure, in general you can add a graphic like that with a span tag with a CSS class, and the CSS will then contain a the image in the content properly with the position adjusted.

      Reply
  6. Jaimie

    hello! Thanks for the guide! is there a way to make all of your “links” on your blog template have this effect using CSS? Thanks!

    Reply
  7. Emma

    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.

    Reply
  8. Caroline

    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

    Reply
    • Hemant Gaba <span class="comment-author-role-label"><a href="https://www.peeayecreative.com/product/divi-adventure-club/" class="comment-author-role-link" rel="external nofollow" target="_blank">Divi Adventure Club Member</a></span>

      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.

      Reply
  9. Charlyne

    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 ?

    Reply
  10. James

    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

    Reply
    • Hemant Gaba <span class="comment-author-role-label"><a href="https://www.peeayecreative.com/product/divi-adventure-club/" class="comment-author-role-link" rel="external nofollow" target="_blank">Divi Adventure Club Member</a></span>

      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

      Reply
  11. Luke

    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?

    Reply
  12. Dawna Graham

    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;
    }

    Reply
    • Hemant Gaba <span class="comment-author-role-label"><a href="https://www.peeayecreative.com/product/divi-adventure-club/" class="comment-author-role-link" rel="external nofollow" target="_blank">Divi Adventure Club Member</a></span>

      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.

      Reply
  13. Kristina

    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!

    Reply
  14. Aron

    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?

    Reply
  15. Sophie Janotta

    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

    Reply
    • Hemant Gaba <span class="comment-author-role-label"><a href="https://www.peeayecreative.com/product/divi-adventure-club/" class="comment-author-role-link" rel="external nofollow" target="_blank">Divi Adventure Club Member</a></span>

      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?

      Reply
  16. Catherine

    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!!

    Reply
  17. Juan Pablo Vásquez

    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!

    Reply
  18. agniswar

    Hey Nelson
    How to make the link text effect like your blog, underline and highlight on hover.

    Reply
    • Hemant Gaba <span class="comment-author-role-label"><a href="https://www.peeayecreative.com/product/divi-adventure-club/" class="comment-author-role-link" rel="external nofollow" target="_blank">Divi Adventure Club Member</a></span>

      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.

      Reply
  19. Agniswar

    How to add style 3 to link text.

    Reply
    • Hemant Gaba <span class="comment-author-role-label"><a href="https://www.peeayecreative.com/product/divi-adventure-club/" class="comment-author-role-link" rel="external nofollow" target="_blank">Divi Adventure Club Member</a></span>

      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.

      Reply
  20. Carly Black

    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?

    Reply
    • Hemant Gaba <span class="comment-author-role-label"><a href="https://www.peeayecreative.com/product/divi-adventure-club/" class="comment-author-role-link" rel="external nofollow" target="_blank">Divi Adventure Club Member</a></span>

      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.

      Reply
  21. Grace Glover

    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.

    Reply
    • Hemant Gaba <span class="comment-author-role-label"><a href="https://www.peeayecreative.com/product/divi-adventure-club/" class="comment-author-role-link" rel="external nofollow" target="_blank">Divi Adventure Club Member</a></span>

      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.

      Reply
  22. Simon

    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

    Reply
    • Hemant Gaba <span class="comment-author-role-label"><a href="https://www.peeayecreative.com/product/divi-adventure-club/" class="comment-author-role-link" rel="external nofollow" target="_blank">Divi Adventure Club Member</a></span>

      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. 🙂

      Reply
  23. Lisa Mann

    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?

    Reply
    • Hemant Gaba <span class="comment-author-role-label"><a href="https://www.peeayecreative.com/product/divi-adventure-club/" class="comment-author-role-link" rel="external nofollow" target="_blank">Divi Adventure Club Member</a></span>

      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. 🙂

      Reply
      • Patricia Rios

        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!

      • Hemant Gaba <span class="comment-author-role-label"><a href="https://www.peeayecreative.com/product/divi-adventure-club/" class="comment-author-role-link" rel="external nofollow" target="_blank">Divi Adventure Club Member</a></span>

        Hey Patricia,

        Could you please share the URL of the website for me to investigate further on this?

      • Lisa Mann

        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?

      • Hemant Gaba <span class="comment-author-role-label"><a href="https://www.peeayecreative.com/product/divi-adventure-club/" class="comment-author-role-link" rel="external nofollow" target="_blank">Divi Adventure Club Member</a></span>

        .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.

  24. Rolf

    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?

    Reply
  25. pan

    i love it , thanks

    Reply
  26. Emma

    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 ‘}’

    Reply
  27. nordie

    this also works
    <mark>highlight</mark> 

    Reply
  28. Francisco

    Excellent tutorial. How can I make that the text is centered in option number 1? It’s always justified to the left. Thanks!

    Reply
  29. brittany

    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?

    Reply
  30. Chadi

    Thank you for this it’s grat. But one question How do you apply this to Meta info

    Reply
      • Chadi

        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.

  31. Alex

    Great tips! Thank you 🙂

    Reply
  32. Paula Cabezas Alvarez

    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?

    Reply
  33. Lydia

    Very useful, thanks Nelson!

    Reply
  34. Fernando

    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

    Reply
  35. Ezinne

    Super useful tips. Thank you so much!

    Reply
  36. Peter

    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!

    Reply
  37. CHARLES KIYIMBA

    Thank you, Nelson. I am learning a lot from you here. I am so appreciative.

    Reply
  38. Guillermo

    Cool Nelson !!!!!. Thank´s again.

    Guillermo

    Reply
  39. Robyn

    Color highlights in text!

    Hi, how do I change the color on number 3 from orange to #E8ADAA?
    Thank you for these tips!

    Reply
    • Nelson Lee Miller (aka The Divi Teacher) <span class="comment-author-role-label author-label">Author</span>

      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!

      Reply
      • Mel

        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?

      • Robyn

        Thank you so much! Still learning all this stuff! Happy holidays.

  40. Samson

    Cool tips! So simple and good looking. Thanks Nelson 🙂

    Reply

Submit a Comment

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

Recent Posts

0

Your Cart