1 property, 44 functions, 22 types defined by this
specification, 46 of them known to at least one browser
(the others are badged Not in any browser yet).
MDN The acos()CSSfunction is a trigonometric function that returns the inverse cosine of a number between -1 and 1. The function contains a single calculation that returns an angle between 0deg and 180deg.
MDN The asin()CSSfunction is a trigonometric function that returns the inverse sine of a number between -1 and 1. The function contains a single calculation that returns an angle between -90deg and 90deg.
MDN The atan()CSSfunction is a trigonometric function that returns the inverse tangent of a number between -∞ and +∞. The function contains a single calculation that returns an angle between -90deg and 90deg.
MDN The atan2()CSSfunction is a trigonometric function that returns the inverse tangent of two values between -infinity and infinity. The function accepts two arguments and returns an angle between -180deg and 180deg, without implying any specific unit such as radians.
Spec The attr() function substitutes the value of an attribute on an element into a property, similar to how the var() function substitutes a custom property value into a function.
MDN The attr()CSSfunction is used to retrieve the value of an attribute of the selected element and use it in a property value, similar to how the var() function substitutes a custom property value. It can also be used with pseudo-elements, in which case the attribute's value on the pseudo-element's originating element is returned.
<blockquote cite="https://mozilla.org/en-US/about/"> Mozilla is working to put control of the internet back in the hands of the people using it.</blockquote><blockquote cite="https://web.dev/about/"> Build beautiful, accessible, fast, and secure websites that work cross-browser.</blockquote>
Spec The calc-interpolate() interpolation notation represents an interpolated numeric or dimensional value. Like calc(), it is a math function, with the following syntax:
Spec The calc-mix() mix notation represents a weighted average of numeric or dimensional value. Like calc(), it is a math function, with the following syntactic form:
Syntax
calc-mix( [ <calc-sum> <percentage [0,100]>? ]# )
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Spec The calc-size() function allows math and transition/animation to be performed on these sizes in a safe, well-defined way. Its syntax is as follows:
Spec The calc() function is a math function that allows basic arithmetic to be performed on numerical values, using addition (+), subtraction (-), multiplication (*), division (/), and parentheses.
FunctionBaseline: widely availablesince January 2023
Spec The clamp() function takes three calculations—a minimum value, a central value, and a maximum value—and represents its central calculation, clamped according to its min and max calculations, favoring the min calculation if it conflicts with the max. (That is, given clamp(MIN, VAL, MAX), it represents exactly the same value as max(MIN, min(VAL, MAX))).
MDN The clamp()CSSfunction clamps a value within a range of values between a defined minimum bound and a maximum bound. The function takes three parameters: a minimum value, a preferred value, and a maximum allowed value.
Live previewExample from MDN
<section class="default-example" id="default-example"> <div class="transition-all" id="example-element"> The font-size of this text varies depending on the base font of the page, and the size of the viewport. </div></section>
MDN The cos()CSSfunction is a trigonometric function that returns the cosine of a number, which is a value between -1 and 1. The function contains a single calculation that must resolve to either a <number> or an angle by interpreting the result of the argument as radians. That is, cos(45deg), cos(0.125turn), and cos(3.14159 / 4) all represent the same value, approximately 0.707.
MDN The exp()CSSfunction is an exponential function that takes a number as an argument and returns the mathematical constant e raised to the power of the given number.
Spec The first-valid() functional notation inlines the fallback behavior intrinsic to parsing declarations. Unlike most notations, it can accept any valid or invalid syntax in its arguments, and represents the first value among its arguments that is supported (parsed as valid) by the UA as the whole value of the property it’s used in.
Syntax
first-valid( <declaration-value># )
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Spec The ident() function represents an arbitrary <ident>, built from one or more separate idents, strings, and integers. It is an arbitrary substitution function.
Syntax
ident( <ident-arg>+ )
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Spec The if() function is an arbitrary substitution function that represents conditional values. Its argument consists of an ordered semi-colon–separated list of statements, each consisting of a condition followed by a colon followed by a value. An if() function represents the value corresponding to the first condition in its argument list to be true; if no condition matches, then the if() function represents an empty token stream.
MDN The if()CSSfunction allows different values to be set for a property depending on the result of a conditional test. The test can be based on a style query, a media query, or a feature query.
Spec Like the inherit keyword, the inherit() functional notation resolves to the computed value of a property on the parent. Rather than resolving to the value of the same property, however, it resolves to a sequence of component values representing the computed value of the property specified as its first argument. Its second argument, if present, is used as a fallback in case the first argument resolves to the guaranteed-invalid value.
FunctionBaseline: widely availablesince January 2023
Spec The min() or max() functions contain one or more comma-separated calculations, and represent the smallest (most negative) or largest (most positive) of them, respectively.
MDN The max()CSSfunction lets you set the largest (most positive) value from a list of comma-separated expressions as the value of a CSS property value. The max() function can be used anywhere a <length>, <frequency>, angle, <time>, <percentage>, <number>, or <integer> is allowed.
FunctionBaseline: widely availablesince January 2023
Spec The min() or max() functions contain one or more comma-separated calculations, and represent the smallest (most negative) or largest (most positive) of them, respectively.
MDN The min()CSSfunction lets you set the smallest (most negative) value from a list of comma-separated expressions as the value of a CSS property value. The min() function can be used anywhere a <length>, <frequency>, angle, <time>, <percentage>, <number>, or <integer> is allowed.
MDN The mod()CSSfunction returns a modulus left over when the first parameter is divided by the second parameter, similar to the JavaScript remainder operator (%). The modulus is the value left over when one operand, the dividend, is divided by a second operand, the divisor. It always takes the sign of the divisor.
Syntax
mod( <calc-sum>, <calc-sum> )
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Browser support
First browser version supporting mod()
Chrome
125
Edge
125
Firefox
118
Safari
15.4
Chrome Android
125
Safari iOS
15.4
First version with support, from MDN browser-compat-data.
Spec The progress() functional notation represents the proportional distance of a given value (the progress value) from one value (the progress start value) to another value (the progress end value), each represented as a calculation. It is a math function, and can be input into other calculations such as a math function or a mix notation. The syntax of progress() is:
MDN The progress()CSSfunction returns a number value representing the position of one value (the progress value) relative to two other values (the progress start and end values).
Spec The random() function is a math function that represents a random value between a minimum and maximum value, drawn from a uniform distribution, optionally limiting the possible values to a step between those limits:
MDN The rem()CSSfunction returns a remainder left over when the first parameter is divided by the second parameter, similar to the JavaScript remainder operator (%). The remainder is the value left over when one operand, the dividend, is divided by a second operand, the divisor. It always takes the sign of the dividend.
Syntax
rem( <calc-sum>, <calc-sum> )
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Browser support
First browser version supporting rem()
Chrome
125
Edge
125
Firefox
118
Safari
15.4
Chrome Android
125
Safari iOS
15.4
First version with support, from MDN browser-compat-data.
Spec The sibling-count() functional notation represents, as an <integer>, the total number of child elements in the parent of the element on which the notation is used.
MDN The sibling-count()CSSfunction returns an integer representing the total number of sibling DOM elements (direct children of the parent) of the element on which it is used, including itself.
Spec The sibling-index() functional notation represents, as an <integer>, the index of the element on which the notation is used among its inclusive siblings. Like :nth-child(), sibling-index() is 1-indexed.
MDN The sibling-index()CSSfunction returns an integer representing the position of the current element in the DOM tree relative to all its sibling elements. The returned value is the index number of the contextual child's position among all the sibling elements within a parent element, with the first child returning 1 and the last child, returning the length of Element.children.
MDN The sign()CSSfunction contains one calculation, and returns -1 if the numeric value of the argument is negative, +1 if the numeric value of the argument is positive, 0⁺ if the numeric value of the argument is 0⁺, and 0⁻ if the numeric value of the argument is 0⁻.
Syntax
sign( <calc-sum> )
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Browser support
First browser version supporting sign()
Chrome
138
Edge
138
Firefox
118
Safari
15.4
Chrome Android
138
Safari iOS
15.4
First version with support, from MDN browser-compat-data.
MDN The sin()CSSfunction is a trigonometric function that returns the sine of a number, which is a value between -1 and 1. The function contains a single calculation that must resolve to either a <number> or an angle by interpreting the result of the argument as radians. That is, sin(45deg), sin(0.125turn), and sin(3.14159 / 4) all represent the same value, approximately 0.707.
MDN The tan()CSSfunction is a trigonometric function that returns the tangent of a number, which is a value between −infinity and infinity. The function contains a single calculation that must resolve to either a <number> or an angle by interpreting the result of the argument as radians.
Spec The <url> type, written with the url() and src() functions, represents a URL, which is a pointer to a resource.
MDN The url()CSSfunction is used to include a file. The parameter is an absolute URL, a relative URL, a blob URL, or a data URL. The url() function can be passed as a parameter of another CSS function, like the attr function. Depending on the property for which it is a value, the resource sought can be an image, font, or a stylesheet. The url() functional notation is the value for the <url> data type.
Live previewExample from MDN
ul { font-size: 3rem; margin: 0;}ul { list-style: outside url("https://mdn.github.io/shared-assets/images/examples/firefox-logo.svg");}
Spec Angle values are <dimension>s denoted by <angle>. The angle unit identifiers are:
MDN The <angle>CSSdata type represents an angle value expressed in degrees, gradians, radians, or turns. It is used, for example, in gradients and in some transform functions.
<section class="default-example" id="default-example"> <div class="transition-all" id="example-element"> This box can rotate to different angles. </div></section>
Browser support
First browser version supporting <angle>
Chrome
2
Edge
12
Firefox
3.6
Safari
4
Chrome Android
18
Safari iOS
3.2
First version with support, from MDN browser-compat-data.
MDN The <calc-keyword>CSSdata type represents well-defined constants such as e and pi. Rather than require authors to manually type out several digits of these mathematical constants or calculate them, a few of them are provided directly by CSS for convenience.
MDN The <calc-sum>CSSdata type represents an expression which performs a calculation in any CSS math function. The expression executes a basic arithmetic operation of addition and subtraction between two values.
Syntax
<calc-product> [ [ '+' | '-' ] <calc-product> ]*
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Spec Some properties accept arbitrary author-defined identifiers as a component value. This generic data type is denoted by <custom-ident>, and represents any valid CSS identifier that would not be misinterpreted as a pre-defined keyword in that property’s value definition. Such identifiers are fully case-sensitive (meaning they’re compared using the "identical to" operation), even in the ASCII range (e.g. example and EXAMPLE are two different, unrelated user-defined identifiers).
MDN The <custom-ident>CSSdata type denotes an arbitrary user-defined string used as an identifier. It is case-sensitive, and certain values are forbidden in various contexts to prevent ambiguity.
Spec The <dashed-ident> production is a <custom-ident>, with all the case-sensitivity that implies, with the additional restriction that it must start with two dashes (U+002D HYPHEN-MINUS).
MDN The <dashed-ident>CSSdata type is a case-sensitive custom-ident starting with two dashes that denotes an arbitrary string used as an identifier.
MDN The <frequency-percentage>CSSdata type represents a value that can be either a frequency or a percentage. Frequency values, e.g., the pitch of a speaking voice, are not currently used in any CSS properties.
Syntax
[ <frequency> | <percentage> ]
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Spec Frequency values are dimensions denoted by <frequency>. The frequency unit identifiers are:
MDN The <frequency>CSSdata type represents a frequency dimension, such as the pitch of a speaking voice. It is not currently used in any CSS properties.
Spec CSS identifiers, generically denoted by <ident>, represent names, and are written as an unquoted sequence of (potentially escaped) characters corresponding to the <ident-token> grammar. [CSS-SYNTAX-3] Identifiers cannot be quoted; otherwise they would be interpreted as strings. CSS properties accept two classes of identifiers: pre-defined keywords and author-defined identifiers.
MDN The <ident>CSSdata type denotes an arbitrary unquoted string of characters used as an identifier.
MDN The <integer>CSSdata type is a special type of number that represents a positive or negative whole number. Integers can be used in numerous CSS properties and descriptors, such as the column-count, counter-increment, grid-column, grid-row, and z-index properties and the range descriptor.
Syntax
<number-token>
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Browser support
First browser version supporting <integer>
Chrome
1
Edge
12
Firefox
1
Safari
1
Chrome Android
18
Safari iOS
1
First version with support, from MDN browser-compat-data.
Spec Number values are denoted by <number>, and represent real numbers, possibly with a fractional component.
MDN The <number>CSSdata type represents a number, being either an integer, a number with a fractional component, or a base-ten exponent in scientific notation.
Browser support
First browser version supporting <number>
Chrome
1
Edge
12
Firefox
1
Safari
1
Chrome Android
18
Safari iOS
1
First version with support, from MDN browser-compat-data.
Spec Percentage values are denoted by <percentage>, and indicates a value that is some fraction of another reference value.
MDN The <percentage>CSSdata type represents a percentage value. It is often used to define a size as relative to an element's parent object. Numerous properties can use percentages, such as width, height, margin, padding, and font-size.
Spec The <position> value specifies the position of an alignment subject (e.g. a background image) inside an alignment container (e.g. its background positioning area) as a pair of offsets between the specified edges (defaulting to the left and top). Its syntax is:
Spec Ratio values are denoted by <ratio>, and represent the ratio of two numeric values. It most often represents an aspect ratio, relating a width (first) to a height (second).
MDN The <ratio>CSSdata type describes the proportional relationship between two values. It mostly represents the aspect ratio, which relates width to height. For example, the <ratio> is used as a value for the aspect-ratio media feature in @media media queries, the aspect-ratio size feature in @container container queries, and as a value for the CSS aspect-ratio property.
Syntax
<number [0,∞]> [ / <number [0,∞]> ]?
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Browser support
First browser version supporting <ratio>
Chrome
3
Edge
12
Firefox
3.5
Safari
5
Chrome Android
18
Safari iOS
4.2
First version with support, from MDN browser-compat-data.
Spec Resolution units are dimensions denoted by <resolution>. The resolution unit identifiers are:
MDN The <resolution>CSSdata type, used for describing resolutions in media queries, denotes the pixel density of an output device, i.e., its resolution.
Browser support
First browser version supporting <resolution>
Chrome
29
Edge
12
Firefox
8
Safari
16
Chrome Android
29
Safari iOS
16
First version with support, from MDN browser-compat-data.
Spec Strings, denoted by <string>, are sequences of characters representing arbitrary textual data. When written literally, they are delimited by double quotes or single quotes, and correspond to the <string-token> production. [CSS-SYNTAX-3].
MDN The <string>CSSdata type represents a sequence of characters. Strings are used in numerous CSS properties, such as content, font-family, and quotes.
Browser support
First browser version supporting <string>
Chrome
1
Edge
12
Firefox
1
Safari
1
Chrome Android
18
Safari iOS
1
First version with support, from MDN browser-compat-data.