Code Snippet

Home » Code Snippets » CSS » Prevent Superscripts and Subscripts from Affecting Line-Height

Prevent Superscripts and Subscripts from Affecting Line-Height

sup, sub {
   vertical-align: baseline;
   position: relative;
   top: -0.4em;
}
sub { top: 0.4em; }

See here for complete reference and demo.

Subscribe to The Thread

  1. rob Jones

    perfect!

    just saved me a tonne of work

  2. royler

    YAY!

  3. Thank you so much! I tried several other options I had found and none worked. Thank you for your genius and generosity. Deep bow.

Speak, my friend

At this moment, you have an awesome opportunity* to be the person your mother always wanted you to be: kind, helpful, and smart. Do that, and we'll give you a big ol' gold star for the day (literally).

Posting tips:
  • You can use basic HTML
  • When posting code, please turn all
    < characters into &lt;
  • If the code is multi-line, use
    <pre><code></code></pre>
Thank you,
~ The Management ~