User:Mzajac/monobook.css/Superscript fix

From Wikipedia, the free encyclopedia

The problem
In Safari 2.03 and Opera 8.51 (and possibly other browsers), superscript and subscript text forces a taller line-height on a line of text. Making the superscript or subscript text smaller helps a bit, but doesn't eliminate the problem. The result is a taller leading space above or below the line, which looks like a paragraph break, and slows reading down.
The solution
A fix is to use relative positioning instead of normal superscript or subscript styling to move the superscript text up or down. Put the following code into your user style (at user:[you]/monobook.css). Then force the updated style sheet to reload, by clicking shift-reload, or alt-refresh on any Wikipedia page. Note: This does not work in Internet Explorer on a PC running XP.
/* keep superscript and subscript text from breaking the line-spacing */
#bodyContent sup {
    font-size: smaller;
    vertical-align: baseline;
    position: relative;
    bottom: 0.33em;
}
#bodyContent sub {
    font-size: smaller;
    vertical-align: baseline;
    position: relative;
    bottom: -0.25em;
}
CSS details
/* ... */ comment
#bodyContent sup { } selector, chooses superscripts in the page body
font-size: smaller; make it smaller (by a factor of 1/1.2 in CSS2)
vertical-align: baseline; neutralize the superscript formatting
position: relative; allow relative positioning
bottom: 0.33em; move it up a third of a line