7

We use a CSS reset file that names every element from html to p to img, etc. and resets the margins, heights, sizes, etc. A pretty standard reset file. However, a client noticed that their <sub> and <sup> tags were not appearing as subscript and superscript should. So, I removed the and tag references from the reset file in hopes of this fixing the problem. It has fixed it in FireFox and Safari but it still remains in IE6 and IE7.

Is there something I'm missing here? Are these tags inheriting their styles from another tag in the reset? And, is there any way to use CSS to re-do whatever may have been undone to the <sub> and <sup> tags in the reset? Thanks for your help.

4

3 回答 3

13
sup {vertical-align: super; }
sub { vertical-align: sub; }
于 2009-11-29T13:54:14.577 回答
6

由于 css 重置可能会影响您的字体大小,因此我是这样做的:

sub {
    vertical-align: sub;
}
sup {
    vertical-align: super;
}
sub, sup {
    font-size: 0.5em;
    line-height: 100%;
}

也许您应该根据您的浏览器尝试不同的vertical-align值。sub

于 2011-08-30T14:46:24.987 回答
1

Without seeing your reset file, it's hard to say for certain. The easiest way to debug this is to load your reset file into an otherwise boring page, break out firebug, and see exactly what the computed style looks like. There may also be some CSS hacks in your reset file that apply only to IE.

You could use vertical-align and font adjustments to bring back the original appearance, but I'm inclined to say it's better to just remove the rules affecting these elements if that part of the reset isn't desired.

于 2009-10-13T19:04:25.493 回答