← Back to home

CSS Functions

Browse all CSS functions with syntax, examples, and practical developer notes.

25 entries

attr()

Retrieves the value of an HTML attribute and uses it in CSS.

Content

calc()

Performs arithmetic operations on numeric values, mixing units.

Math

clamp()

Clamps a value between a minimum, preferred, and maximum.

Math

conic-gradient()

Creates a gradient that rotates around a center point, like a color wheel.

Gradients

counter()

Returns the current value of a named CSS counter.

Content

cubic-bezier()

Defines a custom easing curve for CSS transitions and animations.

Animation

env()

Inserts the value of a user-agent environment variable, like safe area insets on mobile.

Variables

fit-content()

Sizes a grid track to fit its content, clamped to a maximum value.

Grid

format()

Hints at the font format in @font-face src declarations to help browsers load the right file.

Resources

hsl()

Defines a color using hue, saturation, lightness, and optional alpha.

Color

image-set()

Provides multiple image options based on screen resolution, letting the browser pick the best one.

Resources

linear-gradient()

Creates a progressive transition between colors along a straight line.

Gradients

max()

Returns the largest of a list of comma-separated values.

Math

min()

Returns the smallest of a list of comma-separated values.

Math

minmax()

Sets a minimum and maximum size for a grid track.

Grid

oklch()

Defines a color using the perceptually uniform OKLCh color space — lightness, chroma, and hue.

Color

radial-gradient()

Creates a gradient that radiates outward from a central point.

Gradients

repeat()

Repeats a grid track pattern a specified number of times.

Grid

rgb()

Defines a color using red, green, blue, and optional alpha (transparency).

Color

rotate()

Rotates an element clockwise or counterclockwise by a given angle.

Transform

scale()

Scales an element larger or smaller around its transform origin.

Transform

skew()

Skews an element along the X and/or Y axis.

Transform

translate()

Moves an element horizontally and/or vertically without affecting document flow.

Transform

url()

Inserts an external resource such as an image, font, or SVG.

Resources

var()

Inserts the value of a CSS custom property (variable).

Variables