CSS Functions Reference

Complete reference of all CSS functions

About This Reference

This comprehensive reference lists all CSS functions organized by category. Functions are reusable pieces of code that accept parameters and return values, enabling dynamic calculations, transformations, and color manipulations in your stylesheets.

Each function includes a description and example usage. Functions range from basic calculations (calc, min, max) to advanced features like trigonometry, color mixing, and 3D transformations. For detailed tutorials on using these functions, see the related lessons below.

Math Functions

Function Description Links
calc() Perform calculations to determine CSS property values
min() Use the smallest value from a comma-separated list
max() Use the largest value from a comma-separated list
clamp() Clamp value between min and max bounds
round() Round a number to nearest, up, down, or to-zero
mod() Calculate modulus (remainder) of division
rem() Calculate remainder with same sign as dividend
abs() Return absolute value of a number
sign() Return the sign of a number (-1, 0, or 1)

Trigonometric Functions

Function Description Links
sin() Calculate sine of an angle
cos() Calculate cosine of an angle
tan() Calculate tangent of an angle
asin() Calculate arc sine (inverse sine)
acos() Calculate arc cosine (inverse cosine)
atan() Calculate arc tangent (inverse tangent)
atan2() Calculate arc tangent of y/x using quadrant

Exponential & Root Functions

Function Description Links
pow() Raise a number to a power
sqrt() Calculate square root
hypot() Calculate hypotenuse (square root of sum of squares)
log() Calculate natural logarithm
exp() Calculate e raised to a power

Color Functions

Function Description Links
rgb() Define color using red, green, blue values
hsl() Define color using hue, saturation, lightness
hwb() Define color using hue, whiteness, blackness
oklch() Perceptually uniform color (lightness, chroma, hue)
oklab() Perceptually uniform color (lightness, a, b)
lch() CIE LCH color space
lab() CIE LAB color space
color() Specify color in specific color space
color-mix() Mix two colors together
light-dark() Return different values based on user's color-scheme preference (light or dark mode)

Transform Functions

Function Description Links
translate() Move element in 2D space
rotate() Rotate element around origin
scale() Resize element proportionally
skew() Skew element along X and Y axes
matrix() 2D transformation matrix
translate3d() Move element in 3D space
rotate3d() Rotate element around 3D axis
perspective() Set perspective for 3D transforms

Filter Functions

Function Description Links
blur() Apply Gaussian blur
brightness() Adjust brightness
contrast() Adjust contrast
grayscale() Convert to grayscale
hue-rotate() Rotate hue on color wheel
invert() Invert colors
saturate() Adjust saturation
sepia() Apply sepia tone
drop-shadow() Apply shadow following element's shape

Gradient Functions

Function Description Links
linear-gradient() Create linear gradient
radial-gradient() Create radial gradient
conic-gradient() Create conic gradient (color wheel)
repeating-linear-gradient() Repeating linear gradient
repeating-radial-gradient() Repeating radial gradient
repeating-conic-gradient() Repeating conic gradient

Shape Functions

Function Description Links
circle() Define circular shape for clip-path or shape-outside
ellipse() Define elliptical shape for clip-path or shape-outside
inset() Define inset rectangle shape with optional rounded corners
polygon() Define polygon shape with multiple vertices
path() Define shape using SVG path syntax

Easing Functions

Function Description Links
cubic-bezier() Define custom easing curve with four control points
steps() Define stepped easing with discrete intervals
linear() Define linear easing with custom stops for complex curves

Image Functions

Function Description Links
image-set() Provide multiple image sources for resolution-dependent selection
cross-fade() Blend between two or more images

Other Functions

Function Description Links
var() Use value of custom property
url() Load resource from URL
attr() Use HTML attribute value
counter() Display counter value
counters() Display nested counter values
symbols() Define counter symbols inline
fit-content() Clamp size to content with limit
minmax() Define size range for grid tracks
repeat() Repeat grid track definition
env() Use environment variable (safe areas)
anchor() Reference an anchor element's position for positioning
anchor-size() Reference an anchor element's size for sizing calculations

Resources & Tools

Demo