<length>
The <length> CSS data type represents a distance value.
Syntax
The <length> data type consists of a <number> followed by one of the units listed below. As with all CSS dimensions, there is no space between the number and the unit literal. Specifying the length unit is optional if the number is 0.
Without units other than 0 is not supported
Units
Relative length units
Relative lengths represent a measurement in terms of some other distance. Depending on the unit, this distance can be the size of a specific character, the line height, or the size of the viewport.
-
rpx: Responsive pixel. It can be adapted according to the screen width. The specified screen width is750rpx. For example, on iPhone6's the screen width is375px, and there are750physical pixels in total, then750rpx = 375px = 750ppx,1rpx = 0.5px = 1ppx. -
rem: This unit represents thefont-sizeof the root element. When used on thefont-sizeof the root element, it represents its initial value. -
em: This unit represents the calculated value of the element'sfont-size. If used in thefont-sizeproperty itself, it represents thefont-sizevalue inherited by the element. -
vh:1vhis 1% of the viewport height. -
vw:1vwis 1% of the viewport width.
Absolute length units
Absolute length units represent a physical measurement when the physical properties of the output medium are known, such as for print layout. This is done by anchoring one of the units to a physical unit and then defining the others relative to it. The anchoring is done differently for low-resolution devices and high-resolution devices.
-
px: Pixel, equal to a physical pixel multiplied by pixel density, equivalent topton iOS ordpon Android. For high-resolution screens, one CSS pixel implies multiple device pixels. E.g:1px=1/96th of 1in. -
ppx: Physical pixel, equal to the size of an actual pixel on the screen.
Compatibility
LCD tables only load in the browser