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. 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.

Reference

Properties

Functions

Additional functions, including calc-mix(), crossorigin(), first-valid(), if(), integrity(), progress(), random(), random-item(), referrerpolicy(), sibling-count(), sibling-index(), src(), type(), and toggle(), are defined in the specifications, but not yet implemented in browsers.

Data types

Units

Flex units (fr) and container units (cqb,cqh,cqi,cqmax,cqmin,cqw) are defined in the CSS flexible box layout and CSS conditional rules modules, respectively.

Unit categorizations

Key concepts

Guides

CSS data types

Introduction to CSS data types that define typical values accepted by CSS properties and functions.

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

Overview of the textual data types, including pre-defined keyword values, global CSS keyword values, and URLs.

CSS value 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

The CSS math functions that allow a property value to be written as a mathematical expression.

Value definition syntax

The formal grammar used to define the set of valid values for CSS properties and functions.

Learn: Values and units

A look at some of the most frequently used value types, what they are, and how they work.

Specifications

Specification
CSS Values and Units Module Level 3
CSS Values and Units Module Level 4
CSS Values and Units Module Level 5

See also