Change the Superscript Font Size in Divi Modules

Written by Dan Mossop

By default, Divi displays superscripts in modules such as the text module at the same font size as the surrounding text. To improve readability and maintain typographical hierarchy, it’s often preferable to have superscripts appear smaller than the rest of the text within a module.

For those of you looking to customize the appearance of superscripts, this post explains how to do it.

To change the superscript font size in Divi modules:

  1. Navigate to "Divi > Theme Options > General > Custom CSS".
  2. Insert CSS to set the superscript font size to 75% of the base font size and correct its vertical position.
  3. Adjust the font size percentage and position values to suit your site design.

Change the Divi Superscript Font Size with CSS

The following CSS code sets the font size of <sup> elements in a list of common modules to 75% of the default size and adjusts their vertical position:

.et_pb_text sup,       /* Text Module */
.et_pb_blurb sup,      /* Blurb Module */
.et_pb_slider sup,     /* Slider Module */
.et_pb_testimonial sup,  /* Testimonial Module */
.et_pb_accordion_item sup,   /* Accordion Module */
.et_pb_toggle sup,       /* Toggle Module */
.et_pb_cta sup   /* Call to Action Module */ 
{
    font-size: 75%; /* adjust as needed */
    bottom: 1em; /* increase to raise the superscript - the default value is 0.8em */
}

This CSS doesn't just adjust the size but also the vertical alignment of the superscript text within specific Divi modules – namely Text, Blurb, Slider, Testimonial, Accordion, Toggle, and Call to Action modules.

By default, Divi sets the bottom property to 0.8em. Using em units allows this property to scale accordingly when the main text font size changes (since normally the superscript takes the font-size of the surrounding text). But when the font size of the superscript is reduced, the bottom property which is relative to it will also reduce, shifting the superscript down. The 1em value used here corrects for this, keeping the superscript higher up. 

To implement this customization, simply put the above code in the "Divi > Theme Options > General > Custom CSS" box.

You’re free to adjust both the font-size and bottom values to match the design of your site.

Unlock the Full Potential of Shortcodes in Divi!

Empower your Divi site with the Divi Shortcode Enabler. This plugin allows shortcodes to run effortlessly in various Divi module fields, enhancing functionality and customization across your site.

About Dan Mossop

Dan is a Scottish-born web developer, now living in Brisbane with his wife and son. He has been sharing tips and helping users with Divi since 2014. He created Divi Booster, the first Divi plugin, and continues to develop it along with 20+ other Divi plugins. Dan has a PhD in Computer Science, a background in web security and likes a lot of stuff, 

2 Comments

  1. This works great, except when making it smaller, it moves the superscript down towards the bottom of the text. How can we keep it aligned to the top?

    Reply
    • Hi Janelle

      The "bottom" property is the key here — it defines the element's vertical alignment relative to the text baseline. In Divi, the default is 0.8em, which being in "em" units makes it dependent on the font-size – when we decrease the font-size, the bottom value decreases too, moving the subscripted text down. To counter this, you can adjust the "bottom" property value accordingly, e.g.:

      .et_pb_text sup,       /* Text Module */
      .et_pb_blurb sup,      /* Blurb Module */
      /*... other modules ... */
      {
          font-size: 75%;  /* Modify to adjust the size of the superscript text */
          bottom: 1em;  /* Increase this value to shift the superscript up */
      }
      

      With this CSS, the "bottom" value compensates for the change in font size, maintaining the top alignment of your superscript.

      I hope that helps,
      Dan

      Reply

Submit a Comment

Comments are manually moderated and approved at the time they are answered. A preview is shown while pending but may disappear if your are cookies cleared - don't worry though, the comment is still in the queue.

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

We may earn a commission when you visit links on our website.