CSS has several different units for length.
Some properties that set CSS length are width, margin, padding, font-size, border-width, etc.
The length has a number and unit composition such as 10px, 2em, etc.
There must be no spaces between numbers and units. If the length value is 0, units can be omitted.
For some CSS properties, the length can be negative.
There are two types of length units: relative and absolute.
The numbers in the table below indicate the minimum browser version that supports this unit of length.
|em, ex, %, px, cm, mm, in, pt, pc||1.0||3.0||1.0||1.0||3.5|
|vmax||26.0||Not supported||19.0||Not supported||20.0|
Note: Internet Explorer 9 underpins vmin with the non-standard name: vm.
Relative length units indicate a length in respect to another length property. Relative length units scales better between various rendering mediums.
|em||Relative to the text dimension of the component (2em methods multiple times the span of the present textual style)|
|ex||Relative to the x-tallness of the present textual style (once in a while utilized)|
|ch||Relative to width of the "0" (zero)|
|rem||Relative to text dimension of the root element|
|vw||Relative to 1% of the width of the viewport*|
|vh||Relative to 1% of the tallness of the viewport*|
|vmin||Relative to 1% of viewport's* littler measurement|
|vmax||Relative to 1% of viewport's* bigger measurement|
The absolute length unit is a fixed value, which reflects a real physical size. The absolute length unit depends on the output medium and is independent of the environment (display, resolution, operating system, etc.).
|in||inches (1in = 96px = 2.54cm)|
|px *||pixels (1px = 1/96th of 1in)|
|pt||points (1pt = 1/72 of 1in)|
|pc||picas (1pc = 12 pt)|
* Pixels (px) are with respect to the review gadget. For low-dpi gadgets, 1px is one gadget pixel (spot) of the showcase. For printers and high goals screens 1px infers numerous gadget pixels.