ex — the font x-height unit
The ex length unit refers to the x-height of the first available font. It lets dimensions follow font metrics, but does not represent a fixed pixel count or always equal half an em.
CKTIS / CSS
Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.
The ex length unit refers to the x-height of the first available font. It lets dimensions follow font metrics, but does not represent a fixed pixel count or always equal half an em.
The fr unit distributes leftover space among CSS Grid tracks, subject to flex factors and sizing constraints.
The `grad` unit expresses angles in gradians: a full turn is `400grad`, and a right angle is `100grad`. Use it wherever CSS syntax accepts an `<angle>`.
The ic unit measures lengths using the metrics of the 水 glyph in the font used to render it. It is useful for dimensions based on CJK characters.
The `in` unit represents a CSS inch: `1in = 96px = 2.54cm`. It is an absolute length unit, but it does not guarantee a physical one-inch measurement on a screen.
The lh unit ties lengths to an element’s line-height. It aligns spacing with the text rhythm but does not measure actual rendered lines.
The lvh unit represents 1% of the large viewport height, determined assuming retractable browser interface elements are hidden.
The lvmax unit is 1% of the larger dimension of the large viewport, calculated assuming retractable browser interfaces are retracted.
The lvmin unit represents 1% of the large viewport’s smaller dimension, calculated with retractable browser interface elements assumed hidden.
The lvw unit represents 1% of the large viewport width: the size calculated with dynamically retractable browser interface elements assumed to be retracted.
The mm unit represents an absolute CSS length: 25.4mm equals 96px, but does not guarantee physical millimeters on screen.
The `ms` unit represents time in CSS. One millisecond is one thousandth of a second: `250ms` and `0.25s` represent the same duration. Use it in properties that accept values of type `<time>`.
The CSS pc unit represents picas, an absolute length unit: 1pc = 12pt = 16px. It has fixed ratios to other absolute units but does not guarantee a real-world physical size on a screen.
The pt unit represents a CSS point: 1/72 of a CSS inch. Its conversion to px is fixed and independent of font size.
px is an absolute CSS length unit. Its relationship to other absolute units is fixed: 96px = 1in. A CSS pixel does not necessarily correspond to one physical screen pixel.
Q is an absolute CSS length unit: 1Q = 0.25mm. It has a fixed conversion to px but does not guarantee an actual physical measurement on a screen.
The `rad` unit expresses CSS angles in radians. A full turn is 2π radians; values using this unit belong to the `<angle>` type.
The rcap unit expresses a length relative to the root element’s font cap height. On a descendant, unlike cap, it does not depend on that descendant’s font size. On the root itself, changing its font size can change a width expressed in rcap.
The rch length unit equals ch on the document’s root element. It sizes elements using root font metrics rather than the local font size.
The rem unit expresses a length relative to the document root element’s computed font-size. It lets text sizes and spacing share one reference size, independently of the parent element’s font size.
The rex unit expresses a length relative to the root element's font x-height rather than the current element's font.
The ric unit equals ic on the document’s root element. It sizes lengths using the root’s ideographic metrics rather than a descendant’s font size.
The rlh unit expresses a length relative to the root element’s line-height, not that of the element using it.
The `s` unit represents seconds in CSS `<time>` values. A value of `0.5s` equals `500ms`. It can be used, for example, to specify transition durations and delays.