CSS values and units
Every CSS declaration consists of a property/value pair. The value can take various forms depending on the property, such as a single integer, keyword, function, or a combination of different items; some values have units, while others do not. Every property also accepts the CSS-wide values. The CSS values and units module defines the data types — values and units — that CSS properties accept. Thi
Every CSS declaration consists of a property/value pair. The value can take various forms depending on the property, such as a single integer, keyword, function, or a combination of different items; some values have units, while others do not. Every property also accepts the CSS-wide values. The CSS values and units module defines the data types — values and units — that CSS properties accept. This module also defines the CSS value definition syntax, or formal grammar, used to define the set of valid values for every CSS property and function.
> [!NOTE]
> This page introduces a CSS module. To find an exhaustive list of all values, types, and functions defined by CSS specifications, see the [values](/docs/Web/CSS/Reference/Values) reference page.
## Reference
### Properties
- interpolate-size
### Functions
- abs()
- acos()
- asin()
- atan()
- atan2()
- attr()
- calc()
- calc-size()
- clamp()
- cos()
- exp()
- hypot()
- ident()
- if()
- inherit()
- log()
- max()
- min()
- mod()
- pow()
- progress()
- random()
- rem()
- round()
- sibling-count()
- sibling-index()
- sign()
- sin()
- sqrt()
- tan()
- url()
The CSS values and units module also introduces the `calc-mix()`, `first-valid()`, `integrity()`, `random-item()`, `src()`, `type()`, and `toggle()` functions. Currently, no browsers support these features.
### Data types
- angle-percentage
- angle
- [`<attr-name>`](/docs/Web/CSS/Reference/Values/attr#attr-name)
- [`<attr-type>`](/docs/Web/CSS/Reference/Values/attr#attr-type)
- <calc-keyword> (`e`, `pi`, `infinity`, NaN)
- [`<calc-size-basis>`](/docs/Web/CSS/Reference/Values/calc-size#calc-size-basis)
- calc-sum
- custom-ident
- dashed-ident
- dimension
- easing-function
- ident
- integer
- length-percentage
- length
- number
- percentage
- <position>
- ratio
- resolution
- [`<rounding-strategy>`](/docs/Web/CSS/Reference/Values/round#rounding-strategy) (`down`, `up`, `to-zero`)
- string
- [`<syntax>`](/docs/Web/CSS/Guides/Syntax/Introduction)
- time-percentage
- time
- <url>
- [`<url-modifier>`](/docs/Web/CSS/Reference/Values/url_function#url-modifier)
The CSS values and units module also introduces the frequency and frequency-percentage data types. Currently, no browsers support these features.
#### Units
- [`%` (percentage)](/docs/Web/CSS/Reference/Values/percentage)
- [`cap`](/docs/Web/CSS/Reference/Values/length#cap)
- [`ch`](/docs/Web/CSS/Reference/Values/length#ch)
- [`cm`](/docs/Web/CSS/Reference/Values/length#cm)
- [`deg`](/docs/Web/CSS/Reference/Values/angle#deg)
- [`dpcm`](/docs/Web/CSS/Reference/Values/resolution#dpcm)
- [`dpi`](/docs/Web/CSS/Reference/Values/resolution#dpi)
- [`dppx`](/docs/Web/CSS/Reference/Values/resolution#dppx)
- [`dvb`](/docs/Web/CSS/Reference/Values/length#vb)
- [`dvh`](/docs/Web/CSS/Reference/Values/length#vh)
- [`dvi`](/docs/Web/CSS/Reference/Values/length#vi)
- [`dvmax`](/docs/Web/CSS/Reference/Values/length#vmax)
- [`dvmin`](/docs/Web/CSS/Reference/Values/length#vmin)
- [`dvw`](/docs/Web/CSS/Reference/Values/length#vw)
- [`em`](/docs/Web/CSS/Reference/Values/length#em)
- [`ex`](/docs/Web/CSS/Reference/Values/length#ex)
- [`grad`](/docs/Web/CSS/Reference/Values/angle#grad)
- [`Hz`](/docs/Web/CSS/Reference/Values/frequency#hz)
- [`ic`](/docs/Web/CSS/Reference/Values/length#ic)
- [`in`](/docs/Web/CSS/Reference/Values/length#in)
- [`kHz`](/docs/Web/CSS/Reference/Values/frequency#khz)
- [`lh`](/docs/Web/CSS/Reference/Values/length#lh)
- [`lvb`](/docs/Web/CSS/Reference/Values/length#vb)
- [`lvh`](/docs/Web/CSS/Reference/Values/length#vh)
- [`lvi`](/docs/Web/CSS/Reference/Values/length#vi)
- [`lvmax`](/docs/Web/CSS/Reference/Values/length#vmax)
- [`lvmin`](/docs/Web/CSS/Reference/Values/length#vmin)
- [`lvw`](/docs/Web/CSS/Reference/Values/length#vw)
- [`mm`](/docs/Web/CSS/Reference/Values/length#mm)
- [`ms`](/docs/Web/CSS/Reference/Values/time#ms)
- [`pc`](/docs/Web/CSS/Reference/Values/length#pc)
- [`pt`](/docs/Web/CSS/Reference/Values/length#pt)
- [`px`](/docs/Web/CSS/Reference/Values/length#px)
- [`Q`](/docs/Web/CSS/Reference/Values/length#q)
- [`rad`](/docs/Web/CSS/Reference/Values/angle#rad)
- [`rcap`](/docs/Web/CSS/Reference/Values/length#rcap)
- [`rch`](/docs/Web/CSS/Reference/Values/length#rch)
- [`rem`](/docs/Web/CSS/Reference/Values/length#rem)
- [`rex`](/docs/Web/CSS/Reference/Values/length#rex)
- [`ric`](/docs/Web/CSS/Reference/Values/length#ric)
- [`rlh`](/docs/Web/CSS/Reference/Values/length#rlh)
- [`s`](/docs/Web/CSS/Reference/Values/time#s)
- [`svb`](/docs/Web/CSS/Reference/Values/length#vb)
- [`svh`](/docs/Web/CSS/Reference/Values/length#vh)
- [`svi`](/docs/Web/CSS/Reference/Values/length#vi)
- [`svmax`](/docs/Web/CSS/Reference/Values/length#vmax)
- [`svmin`](/docs/Web/CSS/Reference/Values/length#vmin)
- [`svw`](/docs/Web/CSS/Reference/Values/length#vw)
- [`turn`](/docs/Web/CSS/Reference/Values/angle#turn)
- [`vb`](/docs/Web/CSS/Reference/Values/length#vb)
- [`vh`](/docs/Web/CSS/Reference/Values/length#vh)
- [`vi`](/docs/Web/CSS/Reference/Values/length#vi)
- [`vmax`](/docs/Web/CSS/Reference/Values/length#vmax)
- [`vmin`](/docs/Web/CSS/Reference/Values/length#vmin)
- [`vw`](/docs/Web/CSS/Reference/Values/length#vw)
- [`x`](/docs/Web/CSS/Reference/Values/resolution#x)
[Flex units](/docs/Web/CSS/Guides/Values_and_units/Numeric_data_types#flex_units) (`fr`) and [container units](/docs/Web/CSS/Guides/Values_and_units/Numeric_data_types#container_units) (`cqb`, `cqh`, `cqi`, `cqmax`, `cqmin`, `cqw`) are defined in the [CSS grid layout](/docs/Web/CSS/Guides/Grid_layout) and [CSS conditional rules](/docs/Web/CSS/Guides/Conditional_rules) modules, respectively.
#### Unit categorizations
- [Absolute length units](/docs/Web/CSS/Guides/Values_and_units/Numeric_data_types#absolute_length_units) (`cm`, `in`, `mm`, `pc`, `pt`, `px`, `Q`)
- [Angle units](/docs/Web/CSS/Guides/Values_and_units/Numeric_data_types#angle_units) (`deg`, `grad`, `rad`, `turn`)
- [Default viewport units](/docs/Web/CSS/Reference/Values/length#default_viewport_units) (`vb` , `vh`, `vi` , `vmax`, `vmin`, `vw`)
- [Dynamic viewport units](/docs/Web/CSS/Reference/Values/length#dynamic_viewport_units) (`dvb`, `dvh`, `dvi`, `dvmax`, `dvmin`, `dvw`)
- [Frequency units](/docs/Web/CSS/Guides/Values_and_units/Numeric_data_types#frequency_units) (`Hz`, `kHz`)
- [Large viewport-percentage units](/docs/Web/CSS/Reference/Values/length#large_viewport_units) (`lvb`, `lvh`, `lvi`, `lvmax`, `lvmin`, `lvw`)
- [Local font-relative length units](/docs/Web/CSS/Guides/Values_and_units/Numeric_data_types#local_font-relative_lengths) (`cap`, `ch`, `em`, `ex`, `ic`, `lh`)
- [Physical units](/docs/Web/CSS/Guides/Values_and_units/Numeric_data_types#absolute_length_units) (`cm`, `in`, `mm`, `pc`, `pt`, `Q`)
- [Relative length units](/docs/Web/CSS/Guides/Values_and_units/Numeric_data_types) (`cap`, `ch`, `em`, `ex`, `ic`, `lh`, `rem`, `rlh`, `vb`, `vh`, `vi`, `vmax`, `vmin`, `vw`)
- [Resolution units](/docs/Web/CSS/Guides/Values_and_units/Numeric_data_types#resolution_units) (`dpcm`, `dpi` , `dppx`, `x`)
- [Root font-relative length units](/docs/Web/CSS/Guides/Values_and_units/Numeric_data_types#root_font-relative_lengths) (`rcap`, `rch`, `rem`, `rex`, `ric`, `rlh`)
- [Small viewport-percentage unit](/docs/Web/CSS/Reference/Values/length#small_viewport_units) (`svb`, `svh`, `svi`, `svmax`, `svmin`, `svw`)
- [Time units](/docs/Web/CSS/Guides/Values_and_units/Numeric_data_types#time_units) (`ms`, `s`)
- [Viewport units](/docs/Web/CSS/Guides/Values_and_units/Numeric_data_types#viewport_units) (`dvh`, `dvw`, `lvh`, `lvw`, `svh`, `svw`, `vb` , `vh`, `vi` , `vmax`, `vmin`, `vw`)
- [Visual angle unit](/docs/Web/CSS/Guides/Values_and_units/Numeric_data_types#absolute_length_units) (`px`)
### Key concepts
- Advance measure
- [Bracketed range notation](/docs/Web/CSS/Guides/Values_and_units/Value_definition_syntax#bracketed_range_notation_minmax)
- [Component value combinators](/docs/Web/CSS/Guides/Values_and_units/Value_definition_syntax#component_value_combinators)
- [CSS-wide keywords](/docs/Web/CSS/Reference/Values/Data_types#css-wide_keywords)
- Device pixel
- [Functional notation](/docs/Web/CSS/Reference/Values/Functions)
- Identifier
- Interpolation
- Keyword
- [Math function](/docs/Web/CSS/Guides/Values_and_units/Using_math_functions)
- [Numeric data types](/docs/Web/CSS/Guides/Values_and_units/Numeric_data_types)
- Origin
- Pixel
- [Textual data types](/docs/Web/CSS/Guides/Values_and_units/Textual_data_types)
- URL
- [Value definition syntax](/docs/Web/CSS/Guides/Values_and_units/Value_definition_syntax)
## Guides
- [CSS data types](/docs/Web/CSS/Reference/Values/Data_types)
- : Introduction to CSS data types that define typical values accepted by CSS properties and functions.
- [Numeric data types](/docs/Web/CSS/Guides/Values_and_units/Numeric_data_types)
- : Overview of the numeric data types, including integers, numbers, percentages, and dimensions, along with relative and absolute dimensions, angles, and time units.
- [Textual data types](/docs/Web/CSS/Guides/Values_and_units/Textual_data_types)
- : Overview of the textual data types, including pre-defined keyword values, global CSS keyword values, and URLs.
- [CSS value functions](/docs/Web/CSS/Reference/Values/Functions)
- : Overview of the CSS statements that invoke special data processing or calculations to return a CSS value for a CSS property.
- [Using CSS math functions](/docs/Web/CSS/Guides/Values_and_units/Using_math_functions)
- : The CSS math functions that allow a property value to be written as a mathematical expression.
- [Value definition syntax](/docs/Web/CSS/Guides/Values_and_units/Value_definition_syntax)
- : The formal grammar used to define the set of valid values for CSS properties and functions.
- [Using CSS typed arithmetic](/docs/Web/CSS/Guides/Values_and_units/Using_typed_arithmetic)
- : An explanation of CSS typed arithmetic behavior and use cases enabled by it.
- [Learn: Values and units](/docs/Learn_web_development/Core/Styling_basics/Values_and_units)
- : A look at some of the most frequently used value types, what they are, and how they work.
- [CSS value serialization](/docs/Web/API/CSS_Object_Model/CSS_value_serialization)
- : How [CSSOM APIs](/docs/Web/API/CSS_Object_Model) serialize color and other values into standardized string representations.
## Related
- [CSS cascading and inheritance](/docs/Web/CSS/Guides/Cascade) module
- initial
- inherit
- revert
- revert-layer
- unset
- all
- [CSS grid layout](/docs/Web/CSS/Guides/Grid_layout) module
- <flex>
- [Flex units](/docs/Web/CSS/Guides/Values_and_units/Numeric_data_types#flex_units) (`fr`)
- [CSS conditional rules](/docs/Web/CSS/Guides/Conditional_rules) module
- [Container units](/docs/Web/CSS/Guides/Values_and_units/Numeric_data_types#container_units) (`cqb`, `cqh`, `cqi`, `cqmax`, `cqmin`, `cqw`)
- [CSS colors](/docs/Web/CSS/Guides/Colors) module
- <color>
- system-color
- [`color-mix()`](/docs/Web/CSS/Reference/Values/color_value/color-mix)
- [CSS images](/docs/Web/CSS/Guides/Images) module
- image
- gradient
## Specifications
## See also
- [CSS syntax](/docs/Web/CSS/Guides/Syntax) module
- [CSS selectors](/docs/Web/CSS/Guides/Selectors) module
Cite this
"CSS values and units". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Values_and_units JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy