IE忽略HTML SUB元素的字体大小? [英] IE ignores font-size for HTML SUB elements?

查看:312
本文介绍了IE忽略HTML SUB元素的字体大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能存在重复:

我通常精通CSS,但这个问题让我感到吃惊......

I'm usually well-versed in CSS but this issue surprised me...

我有一些简单的标记,包含一些文本和一个子文本:

I have some simple markup consisting of some text and a sub text:

<p>I am a main text<sub>This is a sub text</sub></p>

我已经设置了CSS,因此默认情况下,所有元素的字体大小均为12px。但是,对于子元素,我将取代这一点:

I have set the CSS so that by default, all elements get a font-size of 12px. However, for sub elements I am overruling this:

sub { color:#999; font-size:11px; }

Firefox尊重11px,IE 8不会,它会使它小得多,但它确实尊重颜色推翻。这是设置FIXED字体大小时我期望的最后一件事。我可以保证没有其他CSS规则与此冲突。

Firefox respects the 11px, IE 8 does not, it renders it much smaller, but it does respect the color overrule. This is the last thing I would expect when setting a FIXED font size. I can assure that there are no other CSS rules conflicting with this.

如果我将CSS中的字体大小增加到12px,IE会将其渲染为11px,但是在Firefox中它太大了。有些奇怪的事情发生在IE的SUB元素中。

If I increase the font-size in CSS to 12px, IE will render it at 11px, but then in Firefox it is too big. Something strange is going on with the SUB element in IE.

我有一个解决方案,如果我使用别的方法标记子文本,例如h3, Firefox和IE会正确渲染字体大小。如果没有更好的解决方案,我会朝着这个方向努力,但我只是好奇,是否有更好的解决方案?

I do have a solution, if I use something else to mark the sub text, for example a h3, both Firefox and IE do render the font size correctly. If there is no better solution I will go for that direction, but I'm simply curious if there is a better solution? Also I like the way the markup currently looks.

推荐答案

由于看起来没有CSS修复,所以我决定使用< small> 标记,而不是< sub> 标记。这工作正常,但它确实使我的标记不太清楚。

Since there does not seem to be a CSS fix I have settled on using the <small> tag instead of the <sub> tag. This works fine, although it does make my markup less clear.

这篇关于IE忽略HTML SUB元素的字体大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆