Hire Me

Prevent Superscripts and Subscripts from Affecting Line-Height

How to stop sup and sub tags from affecting the line heights of a paragraph in HTML

Posted on Monday, June 29, 2015 at 2:48 PM into css code by Steve Woods

Sometimes it's problematic to use a tag in your code because it puts a gap between two lines in a paragraph making it look incorrect - here's how to solve it.

Add this to your CSS file:

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

 

;

Comments

Please consider what you post!
Chillax if you're angry.