Em vs Px和跨浏览器兼容性 [英] Em vs Px and cross browser compatibility

查看:131
本文介绍了Em vs Px和跨浏览器兼容性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个CSS新手,并想知道是否有一个好处,使用em而不是px当我的CSS的跨浏览器兼容性。

I'm a CSS newbie and was wondering if there is a benefit using em instead of px when it comes the cross browser compatibility of my CSS.

推荐答案

严格来说,使用em over px不是一个跨浏览器兼容性问题 - 所有浏览器都支持使用

Strictly speaking the use of em over px isn't really a cross-browser compatibility issue - all browsers support the use of them both for font-sizing.

过去,建议避免使用px作为具有最大市场份额的浏览器进行字体大小调整,IE6不允许使用文本调整大小。它将px视为绝对值,而不是像em这样的相对值,因此不会在px中对文本进行缩放。

It used to be advisable to avoid using px for font sizing as the browser with the biggest market share, IE6, wouldn't allow text resizing. It sees px as an absolute value, not a relative value like em, and so wouldn't scale text up or down sized in px.

根据您的受众不需要担心它。关于em的好处有一些很好的信息,以及它们如何帮助在这里建立一个流畅的布局: http:// www。 alistapart.com/articles/fluidgrids/

Depending on your audience you may not need to worry about it. There's some great info on the benefits of the em, and how they can help towards building a fluid layout here: http://www.alistapart.com/articles/fluidgrids/

这篇关于Em vs Px和跨浏览器兼容性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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