我的HTML页面处于某种奇怪的模式,其中sup和sub标签不会提升或降低该行上方的字符,尽管它们确实减少了字符的大小.我放了一个简单的
在我的页面顶部,我打印的是:
我已经尝试了各种字体和大小并重新加载页面,但我还没有找到任何修复它的东西.如果我在jsfiddle中放入相同的代码,它可以正常工作:
有谁知道可能会发生什么?
谢谢.
最佳答案
我遇到了同样的问题,这是由于reset.css引起的.
原文链接:https://www.f2er.com/html/426462.html要解决此问题,请实现以下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;
}