docs.rodeo

MDN Web Docs mirror

CSS value functions

{{CSSRef}} 

CSS value functions are statements that invoke special data processing or calculations to return a CSS value for a CSS property. CSS value functions represent more complex data types and they may take some input arguments to calculate the return value.

Syntax

selector {
  property: function([argument]? [, argument]!);
}

The value syntax starts with the name of the function, followed by a left parenthesis (. Next up are the argument(s), and the function is finished off with a closing parenthesis ).

Functions can take multiple arguments, which are formatted similarly to CSS property values. Whitespace is allowed, but they are optional inside the parentheses. In some functional notations multiple arguments are separated by commas, while others use spaces.

[!NOTE] The CSS value functions are used as property values and should not be confused with pseudo-classes. The functional pseudo-classes, linguistic pseudo-classes, and several tree-structural pseudo-classes require parameter values, but they’re not value functions. The conditional at-rules are also not value functions; the parentheses are used for groupings.

Transform functions

The {{CSSxRef("<transform-function>")}}  CSS data type represent appearance transformation. It is used as a value of {{CSSxRef("transform")}}  property.

Translate functions

Rotation functions

Scaling functions

Skew functions

Matrix functions

Perspective functions

Math functions

The math functions allow CSS numeric values to be written as mathematical expressions.

Each of the pages below contains detailed information about a math function’s syntax, browser compatibility data, examples, and more. For a holistic introduction to CSS math functions, see Using CSS math functions.

Basic arithmetic

Comparison functions

Stepped value functions

Trigonometric functions

Exponential functions

Filter functions

The {{CSSxRef("<filter-function>")}}  CSS data type represents a graphical effect that can change the appearance of an input image. It is used in the {{CSSxRef("filter")}}  and {{CSSxRef("backdrop-filter")}}  properties.

Color functions

The {{CSSxRef("color_value","<color>")}}  CSS data type specifies different color representations.

Image functions

The {{CSSxRef("<image>")}}  CSS data type provides graphical representation of images or gradients.

Gradient functions

Image functions

Counter functions

CSS counter functions are generally used with the {{CSSxRef("content")}}  property, although in theory, they may be used wherever a {{CSSxRef("<string>")}}  is supported.

Shape functions

The {{CSSxRef("<basic-shape>")}}  CSS data type represents a graphical shape. It is used in the {{CSSxRef("clip-path")}} , {{CSSxRef("offset-path")}} , and {{CSSxRef("shape-outside")}}  properties.

Reference functions

The following functions are used as a value of properties to reference a value defined elsewhere:

Grid functions

The following functions are used to define a CSS grid:

Font functions

CSS font functions are used with the {{CSSxRef("font-variant-alternates")}}  property to control the use of alternate glyphs.

Easing functions

The {{CSSxRef("<easing-function>")}}  CSS data type represents a mathematical function. It is used in transition and animation properties:

Animation functions

The following functions are used as a value of different {{CSSxRef("animation-timeline")}}  properties:

Anchor positioning functions

The anchor positioning functions are used when positioning and sizing anchor-positioned elements relative to the location and size of their associated anchor elements.

See also

In this article

View on MDN