CSS Functions

CSS Types and Functions are values that help compute dynamic styles, such as mathematical calculations, color manipulations, and image sources. Browse all 70 css functions in our CSS Reference.

<acos>

Availability Widely Available
Support
92%

A trigonometric function that calculates the arccosine of a number. It's used in advanced CSS math for calculating angles in layouts or animations based on side lengths.

<anchor-size>

Availability Limited
Support
77%

A function that retrieves the width or height of the anchor element. It's incredibly useful for making a popup or menu match the exact dimensions of the button that triggered it.

<anchor>

Availability Limited
Support
77%

Allows an element (like a tooltip or menu) to be docked to another element on the page, ensuring it stays positioned relative to that target even if the page scrolls or layout changes.

Interop 2026 focus area

<angle-percentage>

Availability Widely Available
Support
96%

A combination type that accepts either an explicit angle (like 45deg) or a percentage value that the browser converts into an angle based on a reference.

<angle>

Availability Widely Available
Support
96%

A basic CSS type for rotation values. It can be expressed in degrees (deg), radians (rad), gradians (grad), or turns (turn).

<asin>

Availability Widely Available
Support
92%

A mathematical function that calculates the arcsine (inverse sine) of a number. It's used in advanced CSS math to determine angles based on vertical distances in layouts or animations.

<atan2>

Availability Widely Available
Support
92%

A more advanced arctangent function that takes two numbers (y and x) to calculate the angle from the origin. It correctly handles all four quadrants, making it the most reliable tool for coordinate-based math in CSS.

<atan>

Availability Widely Available
Support
92%

A mathematical function that calculates the arctangent of a number. This is essential for calculating slope-based angles in CSS without needing JavaScript.

<attr>

Availability Widely Available
Support
96%

Retrieves the value of an attribute from an element to use directly in CSS. It is most frequently used with the content property in pseudo-elements.

Interop 2026 focus area

<exp>

Availability Newly Available
Support
88%

A CSS math function that calculates e (Euler's number) raised to the power of a specified number. Useful for complex scientific or geometric layouts.

<flex>

Availability Widely Available
Support
96%

A shorthand property that defines how a flex item grows or shrinks to fit the available space in its container.

<hypot>

Availability Newly Available
Support
88%

A math function that calculates the hypotenuse of a right-angled triangle (the square root of the sum of squares of its arguments). It is useful for complex mathematical layouts where you need to calculate diagonal distances.

<log>

Availability Newly Available
Support
88%

A math function that calculates the logarithm of a number. This is useful for advanced mathematical layouts where you need to scale values non-linearly.

<position>

Availability Widely Available
Support
96%

Specifies how an element is positioned in a document. It allows for static, relative, absolute, fixed, or sticky positioning, which changes how the element interacts with the page flow.

<pow>

Availability Newly Available
Support
88%

An exponential math function that calculates a base raised to the power of an exponent. It's useful for creating non-linear scales (like font sizes or spacing).

<ratio>

Availability Widely Available
Support
96%

A CSS data type representing the proportion of one side to another (like 16 / 9 for widescreen). It's primarily used in the aspect-ratio property or media queries.

<ray>

Availability Widely Available
Support
88%

A function used in the motion path module to define a path that starts at a single point and shoots out in a specific direction (like a ray of light).

<sin>

Availability Widely Available
Support
92%

Calculates the sine of an angle. Part of the trigonometric function suite in CSS, allowing you to create complex circular layouts or wave-like animations.

<sqrt>

Availability Newly Available
Support
88%

Calculates the square root of a number. This is part of the exponent function set in CSS, useful for relative scaling based on geometric areas.

<tan>

Availability Widely Available
Support
92%

Calculates the tangent of an angle. Useful for complex geometric translations or rotations directly in CSS.

<transform-function>

Availability Widely Available
Support
96%

A generic data type representing any function that alters an element's coordinate system. This includes common functions like rotate(), scale(), translate(), and skew().

contrast-color()

Availability Limited
Support
0%

A function that automatically selects a text color with the best contrast against a given background color. It's a game-changer for dynamic themes, ensuring text remains readable regardless of the background.

Interop 2026 focus area

shape()

Availability Limited
Support
0%

A function used in 'clip-path' and other properties to define custom 2D shapes using commands like 'move', 'line', and 'curve'. It's basically like writing SVG paths directly in CSS.

Interop 2026 focus area

<abs>

Availability Newly Available
Support
82%

A mathematical function that turns any number into its positive version. For example, if you have a calculation that results in -10px, abs(-10px) will return 10px.

<basic-shape>

Availability Widely Available
Support
96%

A CSS type that represents a geometric shape. These are used in properties like 'clip-path' and 'shape-outside' to create non-rectangular layouts, such as circles, polygons, or rounded boxes.

<blend-mode>

Availability Widely Available
Support
96%

A type representing the mathematical way two colors mix together. Common values include 'multiply' (darkens), 'screen' (lightens), and 'overlay' (increases contrast), much like layer styles in Photoshop.

<calc-keyword>

Availability Widely Available
Support
94%

A CSS type representing keywords that can be used inside mathematical functions like 'calc()'. Examples include 'e' (base of natural logarithms) and 'pi'.

<calc-size>

Availability Limited
Support
70%

An experimental function that allows performing math on 'intrinsic' sizes like 'auto', 'min-content', or 'fit-content'. This is a key part of making it possible to animate from 'height: 0' to 'height: auto'.

<calc>

Availability Widely Available
Support
96%

Allows you to perform calculations when specifying CSS property values. You can mix different units, like percentages and pixels, in the same expression.

<clamp>

Availability Widely Available
Support
95%

Clamps a value between an upper and lower bound. It accepts a minimum, a preferred, and a maximum value, making it perfect for fluid typography.

<color>

Availability Widely Available
Support
96%

Sets the foreground color of an element's text content. It accepts various formats like HEX, RGB, HSL, and named colors.

<corner-shape-value>

Availability Limited
Support
67%

Represents the specific keywords (like 'round', 'angle', 'bevel') that define how a corner should be shaped.

<counter>

Availability Widely Available
Support
96%

A function used in the 'content' property to display the current value of a CSS counter as text.

<counters>

Availability Widely Available
Support
96%

Similar to 'counter()', but used for nested counters (like 1.1, 1.2, 1.2.1). It combines the values of all counters with the same name into a single string.

<dashed-function>

Availability Limited
Support
67%

An experimental type of CSS function name that starts with two dashes (like '--foo()'). It's intended to be used for custom, user-defined functions in the future.

<dimension>

Availability Widely Available
Support
96%

A general term for any CSS value that combines a number with a unit (like '10px', '2em', or '50%').

<dynamic-range-limit-mix>

Availability Limited
Support
69%

An experimental function that allows you to mix different dynamic range limits (like SDR and HDR) to fine-tune how colors are displayed on high-brightness screens.

<easing-function>

Availability Widely Available
Support
96%

Mathematical functions that control the speed of an animation over time (e.g., starting slow and ending fast). Common ones include 'ease-in', 'ease-out', and the customizable 'cubic-bezier()'.

<env>

Availability Widely Available
Support
95%

A function that allows you to use environment variables defined by the browser, most commonly used to handle 'safe areas' on devices with notches or rounded corners.

<filter-function>

Availability Widely Available
Support
96%

Refers to the specific functions used within the 'filter' property, such as 'blur()', 'contrast()', 'sepia()', or 'drop-shadow()'.

<global_keywords>

Availability Widely Available
Support
96%

Special words like 'inherit', 'initial', 'unset', and 'revert' that can be used on almost any CSS property to control how it handles cascades or default values.

<gradient>

Availability Widely Available
Support
96%

A special image type that transitions smoothly between two or more colors. Common types include 'linear-gradient()', 'radial-gradient()', and 'conic-gradient()'.

<if>

Availability Limited
Support
67%

An experimental function that allows you to apply different values based on a condition (like a media query or a variable state) directly within a property value.

<image>

Availability Widely Available
Support
96%

A generic CSS type representing any data that can be rendered as an image, including URLs (url()), gradients (linear-gradient()), or subsets of other images (image-set()).

<integer>

Availability Widely Available
Support
96%

A CSS data type representing a whole number (positive, negative, or zero). It is used in properties like 'z-index', 'flex-grow', or for counting items.

<length-percentage>

Availability Widely Available
Support
96%

A CSS data type that accepts either a length (like 20px) or a percentage (like 50%). It's used in properties like 'width', 'margin', and 'padding'.

<length>

Availability Widely Available
Support
96%

A CSS data type representing a distance value. It consists of a number followed by a unit (like 'px', 'em', 'rem', 'vw', etc.).

<line-style>

Availability Widely Available
Support
96%

A CSS data type representing the 'style' of a line, used in properties like 'border-style' or 'outline-style'. Common values include 'solid', 'dashed', and 'dotted'.

<max>

Availability Widely Available
Support
95%

Returns the largest (most positive) value from a list of comma-separated expressions. It is useful for creating layouts that grow but don't shrink below a certain point.

<min>

Availability Widely Available
Support
95%

Returns the smallest (most negative) value from a list of comma-separated expressions. It is useful for creating layouts that shrink but don't grow beyond a certain point.

<mod>

Availability Newly Available
Support
86%

A math function that returns the remainder of a division (modulo). This is useful for complex layouts where you need elements to repeat or cycle based on a value.

<number>

Availability Widely Available
Support
96%

A CSS data type representing a real number (which can include decimals). It's used for values like 'opacity', 'line-height' (as a multiplier), or in math functions.

<overflow>

Availability Widely Available
Support
96%

Sets what happens if content is too big to fit into its container. It can be clipped, hidden, or made to scroll.

<percentage>

Availability Widely Available
Support
96%

A CSS data type representing a value relative to something else (usually the parent element's size or another property's value).

<progress>

Availability Limited
Support
72%

A relative math function that calculates how far a value is between two points (a start and an end). It returns a number between 0 and 1, essentially giving you a percentage of completion.

<random>

Availability Limited
Support
3%

A new CSS math function that picks a random value from a range of possibilities. This allows for native CSS randomness without needing JavaScript.

<rem>

Availability Newly Available
Support
86%

A CSS unit that is relative to the font-size of the root element (usually the <html> tag). Unlike 'em', it doesn't change based on the parent's font size, making scaling much more predictable.

<resolution>

Availability Widely Available
Support
95%

A media query property that describes the pixel density of the output device (like a 'Retina' display). It allows you to provide higher-quality images only for screens that can actually see the difference.

<round>

Availability Newly Available
Support
86%

A math function that rounds a value to the nearest multiple of another value. For example, you can use it to ensure a width always rounds to the nearest 10 pixels.

<shape>

Availability Widely Available
Support
96%

A basic data type that defines a 2D shape, like a circle, ellipse, or polygon. It's most commonly used with the 'clip-path' property to cut elements into specific shapes or with 'shape-outside' to make text flow around them.

<sibling-count>

Availability Limited
Support
70%

A new experimental function that returns the total number of siblings an element has. This allows you to style elements based on how many items are currently in a list without using JavaScript.

<sibling-index>

Availability Limited
Support
70%

A new experimental function that returns the 1-based index of an element among its siblings. You can use it to create staggered animations or dynamic styles without nth-child(n) hacks.

<sign>

Availability Newly Available
Support
82%

A math function that returns -1 for negative numbers, 0 for zero, and 1 for positive numbers. It's useful for logic-based styling directly in your CSS.

<string>

Availability Widely Available
Support
96%

A basic data type that represents a sequence of characters, always wrapped in quotes (e.g., 'Hello'). It's most commonly used with the 'content' property in pseudo-elements.

<superellipse>

Availability Limited
Support
67%

A new experimental function for 'corner-shaping' that creates 'squircle' corners. This is the math-based rounding used by Apple in iOS icons to make corners look smoother and more organic than a standard circle.

<text-edge>

Availability Limited
Support
80%

A value type used with 'text-box-edge' to define which lines of the font (like the top of capital letters, the x-height, or the baseline) should be used as the boundaries for trimming.

<time>

Availability Widely Available
Support
96%

The standard CSS data type for durations. It can be defined in seconds (s) or milliseconds (ms).

<type>

Availability Limited
Support
67%

A generic keyword used in newer CSS specs (like Mixins and Functions) to denote a specific data type requirement for a variable or argument.

<url>

Availability Widely Available
Support
96%

The standard CSS function for including external resources like images, fonts, or SVGs into your stylesheet.

<var>

Availability Widely Available
Support
96%

Lets you insert the value of a custom property (CSS Variable) into your stylesheet, making it easier to reuse colors, spacing, and other values across your design.

New CSS drops.

Join 600+ readers who've survived clearfix hacks.

ESC