Перевод не завершен. Пожалуйста, помогите перевести эту статью с английского.

<размер> в CSS -единица информации обозначающая длину. Это <число> за которым следует единица измерения (без пробелов) (px, em, pc, in, mm, …). Если установлено значение равное 0, обозначение единиц измерения не обязательно.

Many CSS properties take <length> values, such as width, marginpadding, font-size, border-width, text-shadow, …

Для некоторых свойств использование отрицательных размеров является синтаксической ошибкой, но для некоторых свойств допустимы отрицательные значения.Заметьте, что <percentage> значения в % также CSS измерения и используются некоторыми CSS свойствами,


are also CSS dimensions and are accepted by some CSS properties that accept <length> values, they are not themselves, <length> values.


Values of the <length> CSS data type can be interpolated in order to allow animations. In that case they are interpolated as real, floating-point, numbers. The interpolation happens on the calculated value. The speed of the interpolation is determined by the timing function associated with the animation.

Единицы измерения

Единицы, относящиеся к другим элементам

Font-relative lengths

Отображает вычисленный font-size элемента. Например если родительский font-size установлен как 4px, установив значение font-size: 0.5em на элементе конечный font-size будет 2px. Другими словами значение em умножает родительский размер на себя.
This unit is often used to create scalable layouts, which keep the vertical rhythm of the page, even when the user changes the size of the fonts. The CSS properties line-height, font-size, margin-bottom and margin-top often have values expressed in em.
This unit represents the x-height of the element's font. On fonts with the 'x' letter, this is generally the height of lowercase letters in the font; 1ex ≈ 0.5em in many fonts.
This unit represents the width, or more precisely the advance measure, of the glyph '0' (zero, the Unicode character U+0030) in the element's font.
This unit represents the font-size of the root element (e.g. the font-size of the <html> element). When used on the font-size on this root element, it represents its initial value.
This unit is practical in creating perfectly scalable layout. If not supported by the targeted browsers, such layout can be achieved using the em unit, though this is slightly more complex.

Viewport-percentage lengths

Viewport-percentage lengths defined a length relatively to the size of viewport, that is the visible portion of the document. Only Gecko-based browsers are updating the viewport values dynamically, when the size of the viewport is modified (by modifying the size of the window on a desktop computer or by turning the device on a phone or a tablet).

In conjunction with overflow:auto, space taken by eventual scrollbars is not subtracted from the viewport, whereas in the case of overflow:scroll, it is.

In a @page at-rule declaration block, the use of the viewport lengths are invalid and the declaration will be dropped.

1/100 высоты дисплея (экрана на котором отображается страница).
1/100th ширины дисплея (экрана на котором отображается страница).
1/100th минимального значения между высотой и шириной дисплея пользователя.
1/100th максимального значения между высотой и шириной дисплея пользователя

Абсолютные единицы измерения размера

Absolute length units represents a physical measurement and when the physical properties of the output medium are known, such as for print layout. This is done by anchored one of the unit to a physical unit and to defined the other relatively to it. The anchor is done differently for low-resolution devices, like screens, and high-resolution devices, like printers.

For low-dpi devices, the unit px represents the physical reference pixel and the others are defined relative to it. Thus, 1in is defined as 96px which equals 72pt. The consequence of this definition is that on such devices, length described in inches (in), centimeters (cm), millimeters (mm) doesn't necessary match the length of the physical unit with the same name.

For high-dpi devices, inches (in), centimeters (cm), millimeters (mm) are defined as their physical counterparts. Therefore the px unit is defined relative to them (1/96 of 1 inch).

Users may increase font size for accessibility purpose. To allow for usable layouts whatever is the used font size, use only absolute length units when the physical characteristics of the output medium are known, such as bitmap images. When setting length related to font-size, prefer relative units like em or rem.

Соотносится с устройством пользователя.
Для экранов, обычно один пиксель дисплея.
For printers and very high resolution screens one CSS pixel implies multiple device pixels, so that the number of pixel per inch stays around 96.
Четверть миллиметра (1/40 сантиметра).
Сантиметр  (10 миллиметров).
Дюйм (2,54 см).
Типографский пункт (1/72 дюйма).
Типографская пика (12 пунктов).
An experimental unit which attempts to render at exactly one millimeter regardless of the size or resolution of the display. This is rarely actually what you want, but may be useful in particular for mobile devices.

CSS units and dots-per-inch

The unit in doesn't represent a physical inch on screen, but represents 96px. That means that whatever is the real screen pixel density, it is assumed to be 96dpi. On devices with a greater pixel density, 1in will be smaller than 1 physical inch. Similarly mm, cm, and pt are not absolute length.

Некоторые частные случаи:

  • 1in это всегда 96px,
  • 3pt это всегда 4px,
  • 25.4mm это всегда 96px.


Specification Status Comment
CSS Values and Units Module Level 3
Определение '<length>' в этой спецификации.
Кандидат в рекомендации Added ch, rem, vw, vh, vmin, vmax and q
CSS Level 2 (Revision 1)
Определение '<length>' в этой спецификации.
Рекомендация pt, pc, px are explicitly defined (were implicitly defined in CSS1)
CSS Level 1
Определение '<length>' в этой спецификации.
Рекомендация Initial definition

Совмстимость с браузерами

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!


Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 1 1.0 (1.7 или ранее) 3.0 3.5 1.0


1.0 (1.7 или ранее)[1] 9.0 20.0 7.0
ex (Да) (Да) ? ? ?
rem 4 (532.3) 3.6 (1.9.2) 9.0 11.6 4.1
vh, vw 20 19 (19) 9.0 20.0 6.0


19 (19) 9.0[2] 20.0 6.0
vmax 26 19 (19) Нет 20.0 (Да)
Viewport-percentage lengths invalid in @page ? 21 (21) ? ? ?
mozmm Нет 4.0 (2.0) Нет Нет Нет
1in always is 96dpi (Да) 4.0 (2.0) (Да) (Да) (Да)
q Нет 49.0 (49.0) Нет Нет ?
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support (Да) (Да) (Да) (Да) (Да)
ch Нет (Да) 7.8 ? 7.1.1
ex ? (Да) ? ? ?
rem 2.1 (Да) ? 12.0 4.0
vh, vw, vmin (Да) 19.0 (19) ? Нет 6.0
vmax 1.5 19.0 (19) ? Нет 4.0
Viewport-percentage lengths invalid in @page ? 21.0 (21.0) ? ? ?
q ? 49.0 (49.0) ? ? ?

[1] In Gecko 1.0-1.9.0 (Firefox 1.0-3.0) ch was the width of 'M' and it didn't work for border-width and outline-width CSS properties.

[2] Internet Explorer implements this with the non-standard name vm.

Метки документа и участники

Внесли вклад в эту страницу: Fgeniy, Zamkevich, VladdOs
Обновлялась последний раз: Fgeniy,