标签:nta follow relative 不同 字母 depends 像素 lower style
absolute units
The relation between the absolute units is as follows: 1in = 2.54cm = 25.4mm = 72pt = 6pc
绝对单位之间的关系如下:1in = 2.54cm = 25.4mm = 72pt = 6pc
relative units
1em 等于当前的字体尺寸。
2em 等于当前字体尺寸的两倍。
例如,如果某元素以 12pt 显示,那么 2em 是24pt。
在 CSS 中,em 是非常有用的单位,因为它可以自动适应用户所使用的字体。
The em and ex units depend on the font and may be different for each element in the document. The em is simply the font size. In an element with a 2in font, 1em thus means 2in. Expressing sizes, such as margins and paddings, in em means they are related to the font size, and if the user has a big font (e.g., on a big screen) or a small font (e.g., on a handheld device), the sizes will be in proportion.
em和ex单位取决于字体,对于文档中的每个元素可能不同。 em只是字体大小。 在具有2英寸字体的元素中,1em因此意味着2英寸。 在em中表示大小(例如边距和填充)意味着它们与字体大小相关,并且如果用户具有大字体(例如,在大屏幕上)或小字体(例如,在手持设备上),则尺寸会保持比例。
一个 ex 是一个字体的 x-height。 (x-height 通常是字体尺寸的一半。)
The ex unit is rarely used. Its purpose is to express sizes that must be related to the x-height of a font. The x-height is, roughly, the height of lowercase letters such as a, c, m, or o. Fonts that have the same size (and thus the same em) may vary wildly in the size of their lowercase letters, and when it is important that some image, e.g., matches the x-height, the ex unit is available.
ex单位很少使用。 其目的是表示必须与字体的x-height相关的大小。 x高度大致是小写字母的高度,例如a,c,m或o。 具有相同大小(并因此相同的em)的字体可能在其小写字母的大小上变化很大,并且当一些图像(例如,匹配x-height)很重要时,ex单元是可用的。
The px
unit is the magic unit of CSS. It is not related to the current font and usually not related to physical centimeters or inches either. The px
unit is defined to be small but visible, and such that a horizontal 1px wide line can be displayed with sharp edges (no anti-aliasing). What is sharp, small and visible depends on the device and the way it is used: do you hold it close to your eyes, like a mobile phone, at arms length, like a computer monitor, or somewhere in between, like an e-book reader? The px
is thus not defined as a constant length, but as something that depends on the type of device and its typical use.
px单元是CSS的神奇单元。 它与当前字体无关,通常与物理厘米或英寸无关。 px单元被定义为小但可见,并且可以显示具有锐边的水平1px宽线(无抗锯齿)。 什么是锋利的,小的和可见的取决于设备及其使用方式:你把它靠近你的眼睛,如手机,手臂长度,如电脑显示器,或介于两者之间,如电子阅读器? 因此,px不被定义为恒定长度,而是取决于设备的类型及其典型用途。
标签:nta follow relative 不同 字母 depends 像素 lower style
原文地址:https://www.cnblogs.com/BigWatermelon/p/9756473.html