IE 和 Firefox 中的文本大小不同
为什么 IE 中的文本比 Firefox 中的文本稍大(宽)? 示例(顶部是 IE 渲染文本的方式,底部是 FF):
声明的文本在 CSS 中为 Arial 16px。 我知道 IE 中有抗锯齿功能,但在我看来,它不应该使字体变大。这里是这样吗?它破坏了我的设计,除了减小字体大小之外我还能做些什么吗?
谢谢!
Why is a text slightly bigger (wider) in IE than in Firefox?
Example (on the top is how IE renders the text, bottom is FF):
The text declared in CSS as Arial 16px.
I know that there is a anti-aliasing in IE but it should not make the font bigger IMO. Is it the case here? It breaks my design, can I do anything about it other than decreasing the font size?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
使用不同类型的字体文件(eot、woff2、woff、ttf、otf)对我有用。我使用 https://onlinefontconverter.com/ 将字体文件转换为我需要的类型,同时它还减小了它们的大小。
这是我用来将所有文件切换为 css 的 SCSS mixin:
Using different types of font files (eot, woff2, woff, ttf, otf) works for me. I use https://onlinefontconverter.com/ to convert font files into types I need, also it reduces them sizes.
Here's my SCSS mixin I use to switch all files into css:
其中之一看起来几乎是大胆的。正如 Carl 建议的那样,尝试让您的设计更能接受不同的文本大小,特别是对于那些加大文本大小以便他们可以看到的用户。至于浏览器之间的细微差别,有时使用 CSS 重置器可以帮助
http://www. maxdesign.com.au/articles/css-reset/
One of them almost looks bolded. As suggested by Carl try and make your design more accepting of different text sizes, especially for users that crank up the text size so they can see. As for the minor differences between browsers sometimes using a css resetter can help
http://www.maxdesign.com.au/articles/css-reset/
还可以尝试显式设置 sans-serif 等的
font-family
属性的“第二部分”:如果是抗锯齿,则 IE 中没有 CSS 设置可以更改此设置。此外,操作系统也会影响字体的呈现方式、ClearType 等。
Also try explicitly setting the "second part" of the
font-family
attribute for sans-serif, etc:If it is anti aliasing, there is no CSS setting to change this in IE. Also the operating system can have an affect on how the font is rendered, ClearType, etc.
您是否尝试过字体大小调整
示例:字体大小调整:0.47;
Have you tried font-size-adjust
Example : font-size-adjust: 0.47;
如果您绝对必须在所有浏览器中拥有像素完美的设计(不推荐;只需在这些部分使用图像),我会尝试从 CSS 重置开始。
这是一行非常的 CSS,您可以将其插入样式表的顶部以“重置”CSS。浏览器倾向于使用它们自己的默认值,如果您不考虑它们,事情可能看起来很奇怪。
功劳归于雅虎!: http://developer.yahoo.com/yui/3/cssreset/ 。
If you absolutely must have a pixel-perfect design in all browsers (not recommending it; just use images for those parts), I'd try starting with a CSS reset.
Here's a really long line of CSS that you can insert into the top of your stylesheet to "reset" the CSS. Browsers tend to use their own defaults, and if you don't account for them, things might look wacky.
Credit goes to Yahoo!: http://developer.yahoo.com/yui/3/cssreset/.