我的HTML页面处于某种奇怪的模式,其中sup和sub标签不会提升或降低该行上方的字符,尽管它们确实减少了字符的大小.我放了一个简单的
<body>
<p class="sample" style="margin-left:10px;">X<sup>2</sup> T<sub>3</sub></p>
Run Code Online (Sandbox Code Playgroud)
在我的页面顶部,我打印的是:

我已经尝试了各种字体和大小并重新加载页面,但我还没有找到任何修复它的东西.如果我在jsfiddle中放入相同的代码,它可以正常工作:

有谁知道可能会发生什么?
谢谢.
Dan*_*iel 15
我遇到了同样的问题,这是由于reset.css引起的.
要解决此问题,请实现以下CSS(在此处找到:https://gist.github.com/unruthless/413930):
sub, sup {
/* Specified in % so that the sup/sup is the right size relative to the surrounding text */
font-size: 75%;
/* Zero out the line-height so that it doesn't interfere with the positioning that follows */
line-height: 0;
/* Where the magic happens: makes all browsers position the sup/sup properly, relative to the surrounding text */
position: relative;
/* Note that if you're using Eric Meyer's reset.css, this is already set and you can remove this rule */
vertical-align: baseline;
}
sup {
/* Move the superscripted text up */
top: -0.5em;
}
sub {
/* Move the subscripted text down, but only half as far down as the superscript moved up */
bottom: -0.25em;
}
Run Code Online (Sandbox Code Playgroud)
我使用了以下CSS:
\n\nfont-size:70%;\nvertical-align:super;\nRun Code Online (Sandbox Code Playgroud)\n\nfont-size:70%;\nvertical-align:super;\nRun Code Online (Sandbox Code Playgroud)\r\n| 归档时间: |
|
| 查看次数: |
9100 次 |
| 最近记录: |