如何使用“em”?帮我CSS?
我听说建议使用“em”作为字体大小。我已经尝试过了,但我真的看不出它有什么好处。事实上,我所有的同事都很困惑。
我在互联网上读过一些关于 %、em 和 px 的文章。他们都建议他们,但我真的不明白。是的,我可以使用 em 一次性更改所有字体大小...是这样吗?
我已经尝试了几款智能手机,它们都毫无问题地显示“px”...
请有人指导我!
谢谢
I've heard that using 'em' for font size is recommended. I've tried it, but I really don't see any advantage of it. Actually, all of my co-workers were confused.
I've read few articles over the internet about %, em, and px. All of them suggested em, but I really don't understand it. Yes, I can change all the font size at once by using em...is that it?
I've tried several smartphones and all of them displayed 'px' without a problem...
Someone please guide me!
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
字体单元
em
允许您根据浏览器的配置显示字体大小(以及其他元素的大小,例如图像)。您仍然可以使用
px
作为字体单位,但移动设备上的 14px 浏览器与桌面浏览器上的 14px 不同。The font unit
em
allows you to display font size ( as well as other element's size , e.g. images ) based on browser's configuration.You can still use
px
as font unit, but 14px browser on mobile is different than 14px on desktop browser.