CSS测量单元实际上代表什么?

前端之家收集整理的这篇文章主要介绍了CSS测量单元实际上代表什么?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
正如标题所说,我想知道什么是CSS单元’em’代表。
如’cm’代表厘米。

我不是问什么’em’是或如何使用!

我在W3C找不到答案。
Wikipedia文章已经在说“东西”:

The name of em is related to M. Originally the unit was derived from the width of the capital “M” in the given typeface.

我对第一句话的解释是“em”是字母“M”的发音/语音。
但阅读第二句话,似乎’e’在’em’代表一些关于字母’M’的宽度。
所以我还是迷路了,什么’em’真正代表!

解决方法

这是一个历史定义;在现代用法中,它仅仅指字体的大小,其中词“em”本身不再具有任何实际或相关意义。事实上,同样的维基百科文章扩展了其在 a later section的使用和意义的这一演变:

One em was traditionally defined as the width of the capital “M” in the current typeface and point size,as the “M” was commonly cast the full-width of the square “blocks”,or “em-quads” (also “mutton-quads”),which are used in printing presses. However,in modern typefaces,the character M is usually somewhat less than one em wide. Moreover,as the term has expanded to include a wider variety of languages and character sets,its meaning has evolved; this has allowed it to include those fonts,typefaces,and character sets which do not include a capital “M”,such as Chinese and the Arabic alphabet. Thus,em generally means the point size of the font in question,which is the same as the height of the Metal body a font was cast on.

特别是在CSS方面,“em”不一定指的是特定字体的大写字母M的宽度;它只是一个相对数量

如果你问的是字词“em”的词源,维基百科本身只包含对Adobe Glossary的引用,其中没有更多的说法:

A common unit of measurement in typography. Em is traditionally defined as the width of the uppercase M in the current face and point size. It is more properly defined as simply the current point size. For example,in 12-point type,em is a distance of 12 points.

它没有明确提到任何权威,它是一个语音表示的首都M,但考虑到它的名字定义,我不会排除这种可能性。

猜你在找的CSS相关文章