Images, shapes & positions

The types for images and gradients, URLs, geometric shapes, positions inside a box, the box keywords that pick a reference edge, blend modes and corner shapes. The functions that produce these values are under Gradients and Shapes & images; colours are under Colors.

Images

<image>

A two-dimensional image: a file loaded with url(), a gradient generated by the browser, or a choice between candidate images with image-set(). Gradients have no natural size and fill whatever area they are given.

Syntax<url> | <image()> | <image-set()> | <cross-fade()> | <element()> | <gradient>
Used bybackground-image, border-image-source, mask-image, list-style-image, content, shape-outside
SupportChrome 1 · Firefox 1 · Safari 1
Speccss-images-4
FormGivesSupport
url()An image file: PNG, JPEG, GIF, WebP, AVIF, SVG and so on.All browsers
<gradient>A linear, radial or conic gradient.Chrome 26 · Firefox 3.6 · Safari 7
image-set()The best of several candidates, chosen by resolution or file type.Chrome 113 · Firefox 89 · Safari 17
cross-fade()A blend of two images at a given percentage.Chrome no · Firefox no · Safari 10
background-image: image-set("hero.avif" type("image/avif"), "hero.jpg" type("image/jpeg"));
Serve AVIF where it is supported and JPEG elsewhere.

<gradient>

An image of colours blending smoothly along a line, out from a point, or around a centre. The repeating forms tile their colour stops to fill the box.

Syntax[ <linear-gradient()> | <repeating-linear-gradient()> | <radial-gradient()> | <repeating-radial-gradient()> | <conic-gradient()> | <repeating-conic-gradient()> ]
Used byAnywhere an <image> is accepted, most often background-image and mask-image
SupportChrome 26 · Firefox 3.6 · Safari 7
Conic gradients: Chrome 69 · Firefox 83 · Safari 12.1
Colour interpolation method (in oklch …): Chrome 111 · Firefox 127 · Safari 16.2
Speccss-images-4

Each gradient function is described under Gradients. Every form accepts a <color-interpolation-method> to choose the colour space the stops blend in.

background: linear-gradient(to right in oklab, #0b6, #06c);
A left-to-right gradient blended in Oklab.

<url>

A reference to a file, written url("path"). The quotes are optional, but an unquoted URL cannot contain spaces, quotes or brackets without escaping. A relative URL resolves against the stylesheet it appears in, not the page.

Syntax<url()> | <src()>
Used by<image> values, cursor, filter and clip-path (to reference SVG), @import and the src descriptor of @font-face
SupportChrome 1 · Firefox 1 · Safari 1
Request modifiers cross-origin(), referrer-policy(): Chrome 150 · Firefox no · Safari 26.2
Request modifier integrity(): Chrome 150 · Firefox no · Safari no
Speccss-values-4

A URL starting with # points at an element in the current document, as in clip-path: url(#wave) for an inline SVG <clipPath>.

Shapes & positions

<basic-shape>

A geometric shape described by a function: a rectangle, circle, ellipse, polygon or free path. Shapes are drawn in a reference box, which the property using them can name with a box keyword.

Syntax<basic-shape-rect> | <circle()> | <ellipse()> | <polygon()> | <path()> | <shape()>
Used byclip-path, shape-outside, offset-path, object-view-box
SupportChrome 37 · Firefox 54 · Safari 10.1
Speccss-shapes-1
FunctionShapeSupport
inset()A rectangle inset from the box edges, with optional rounded corners.Chrome 37 · Firefox 54 · Safari 10.1
rect(), xywh()A rectangle by its edges, or by position and size.Chrome 119 · Firefox 122 · Safari 17.2
circle()A circle with a radius and centre.Chrome 37 · Firefox 54 · Safari 10.1
ellipse()An ellipse with two radii and a centre.Chrome 37 · Firefox 54 · Safari 10.1
polygon()Straight lines between a list of points.Chrome 37 · Firefox 54 · Safari 10.1
path()An SVG path data string.Chrome 52 · Firefox 72 · Safari 13.1
shape()A path written with CSS commands and units, so it can be responsive.Chrome 135 · Firefox 148 · Safari 18.4

See Shapes & images for each function's arguments. A shape can animate to another shape made by the same function; two polygon() shapes also need the same number of points.

clip-path: polygon(50% 0, 100% 100%, 0 100%);
Clip an element to a triangle.

<position>

A point inside a box, given as one, two or four parts. Keywords name an edge or the centre; lengths and percentages measure from the left and top edges. A percentage aligns the same point of the item with the same point of the box, so 100% 100% puts an image flush in the bottom-right corner.

Syntax<position-one> | <position-two> | <position-four>
Used bybackground-position, object-position, mask-position, perspective-origin, offset-position, and the at part of radial-gradient() and circle()
SupportChrome 1 · Firefox 1 · Safari 1
Four-value form: Chrome 25 · Firefox 13 · Safari 7
Speccss-values-5
FormExampleMeaning
One valuecenter, top, 25%The other axis is center.
Two valuesleft top, 30% 2remHorizontal then vertical. Two keywords may come in either order.
Four valuesright 1rem bottom 2remEach keyword is followed by an offset from that edge.

Reference boxes

<visual-box>

One of the three CSS boxes an element draws: its content, its content plus padding, or everything up to the outer edge of its border.

Syntaxcontent-box | padding-box | border-box
Used bybackground-origin, background-clip, overflow-clip-margin, and the box types below
Speccss-box-4
KeywordEdge
content-boxThe edge of the content area, inside the padding.
padding-boxThe outer edge of the padding, inside the border.
border-boxThe outer edge of the border.

<coord-box>

A reference box for drawing and positioning: one of the visual boxes, or for SVG elements the fill box, stroke box or the nearest viewport. Its <paint-box> part is the visual boxes plus fill-box and stroke-box.

Syntax<paint-box> | view-box, where <paint-box> is <visual-box> | fill-box | stroke-box
Used bymask-clip, mask-origin, offset-path
Speccss-box-4

<shape-box>

The reference box for a float's wrap shape: one of the visual boxes, or margin-box to include the float's margins. Text wraps around the chosen box, or around a <basic-shape> drawn in it.

Syntax<visual-box> | margin-box | half-border-box
Used byshape-outside
Speccss-shapes-1

<geometry-box>

The reference box for a clipping shape. It accepts the CSS boxes and the SVG boxes, so the same clip-path works on HTML and SVG elements.

Syntax<shape-box> | fill-box | stroke-box | view-box
Used byclip-path
Speccss-masking-1
KeywordBox
margin-boxThe outer edge of the margin.
fill-boxThe object bounding box of an SVG element: its geometry without the stroke. On HTML elements, content-box.
stroke-boxThe SVG stroke bounding box, including the stroke. On HTML elements, border-box.
view-boxThe nearest SVG viewport. On HTML elements, border-box.
clip-path: circle(50%) padding-box;
A circle sized against the padding box, so the border is clipped away.

Blending & corners

<blend-mode>

How a layer's colours combine with the colours behind it, as in image-editing software. The separable modes work on each colour channel independently; the last four work on hue, saturation and luminosity.

Syntaxnormal | darken | multiply | color-burn | lighten | screen | color-dodge | overlay | soft-light | hard-light | difference | exclusion | hue | saturation | color | luminosity
Used bymix-blend-mode, background-blend-mode
SupportChrome 35 · Firefox 30 · Safari 8
Speccompositing-2
ModeResult
normalThe top colour only; no blending.
multiplyMultiplies the colours. Always darker; white has no effect.
screenMultiplies the inverses. Always lighter; black has no effect.
overlaymultiply or screen, depending on the backdrop colour.
darkenThe darker of the two, channel by channel.
lightenThe lighter of the two, channel by channel.
color-dodgeBrightens the backdrop to reflect the top colour.
color-burnDarkens the backdrop to reflect the top colour.
hard-lightmultiply or screen, depending on the top colour.
soft-lightA gentler version of hard-light.
differenceThe absolute difference between the colours.
exclusionLike difference, with lower contrast.
hueThe top layer's hue with the backdrop's saturation and luminosity.
saturationThe top layer's saturation with the backdrop's hue and luminosity.
colorThe top layer's hue and saturation with the backdrop's luminosity.
luminosityThe top layer's luminosity with the backdrop's hue and saturation.

mix-blend-mode also accepts plus-lighter, which adds the colours together; it is not part of <blend-mode>, so background-blend-mode does not take it.

<corner-shape-value>

The shape of a rounded corner, drawn within the area that border-radius sets aside. Without a radius, the corner shape has no effect.

Syntaxround | scoop | bevel | notch | square | squircle | <superellipse()>
Used bycorner-shape and its per-corner longhands such as corner-top-left-shape
SupportChrome 139 · Firefox no · Safari no
Speccss-borders-4
ValueCornerAs superellipse()
roundThe usual convex quarter-ellipse.superellipse(1)
squircleBetween round and square, with a flatter curve.superellipse(2)
squareA sharp right-angled corner, as if there were no radius.superellipse(infinity)
bevelA straight diagonal cut.superellipse(0)
scoopA concave quarter-ellipse, curving inward.superellipse(-1)
notchA concave right-angled notch.superellipse(-infinity)
border-radius: 1.5rem;
corner-shape: squircle;
Smooth, app-icon style corners.