Firefox与其他浏览器的区别不同(CSS中的负字母间距)

时间:2010-07-08 14:48:03

标签: css firefox typography

当应用负字母间距时,我遇到的问题与其他浏览器的文本呈现方式不同:

h2{font-size:1.6em;font-weight:bold;color:#999;letter-spacing:-0.10em;}

<h2>Time</h2>(approx)

以下是大多数浏览器中呈现的文字:http://img707.imageshack.us/i/font2x.png/

以下是在Firefox中呈现的文字:http://img444.imageshack.us/i/font1.png/

编辑:它们是直接截图,图像的分辨率相同。

有关如何解决此问题的任何想法?

3 个答案:

答案 0 :(得分:1)

我不知道为什么,但如果您在pt声明中使用em代替font-size(但em保留letter-spacing,则应该像其他浏览器一样呈现你的文字。

h2{font-size:18pt;font-weight:bold;color:#999;letter-spacing:-0.10em;}

答案 1 :(得分:0)

将声明width: 100%;添加到h2规则以触发“其他”浏览器中的布局。

答案 2 :(得分:0)

我通过重置css来解决这个问题。只需将以下链接添加到您的html头部。

<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.9.0/build/reset/reset-min.css">

可在此处找到更多信息。 http://developer.yahoo.com/yui/reset/