CSS中em和en有什么区别
我正在使用一些(有问题且奇怪的)CSS,我想知道在确定大小时 en 和 em 之间的区别是什么 font-size:12en;高度:3em;
。
I am working with some (problematic and strange) css, and I am wondering what the difference between en and em is when determining sizes font-size:12en; height:3em;
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它在 HTML/CSS 中无效,但在非网络印刷机中使用:
维基百科在 em 下提到了它:
It is invalid in HTML/CSS however it is used in non-web print presses:
Wikipedia mentions it under em:
在 CSS 中,“em”是一个相对印刷单位,等于字体大小。如果您的字体大小是 12px,那么该元素的 1em 就是 12px。由于“em”是相对测量单位,因此当对具有不同字体大小的多个元素进行排版更改时,这会有所帮助,例如,如果您有:
那么字母之间的间距在视觉上将是相等的。
In CSS 'em' is a relative typographical unit that is equal to the font-size. If your font-size is 12px, then 1em is 12px for that element. Since 'em' is a relative unit of measurement, this helps when making typographical changes to multiple elements with different font sizes, for instance if you have:
then the spacing between letters would be visually equal.