This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
* Some parts of this feature may have varying levels of support.
The <image> CSS data type represents a two-dimensional image.
The <image> data type can be represented with any of the following:
<url> data type<gradient> data typeelement() functionimage() functioncross-fade() function.image-set() function.paint() function.CSS can handle the following kinds of images:
CSS determines an object's concrete size using (1) its intrinsic dimensions; (2) its specified size, defined by CSS properties like width, height, or background-size; and (3) its default size, determined by the kind of property the image is used with:
| Kind of Object (CSS Property) | Default object size |
|---|---|
background-image | The size of the element's background positioning area |
list-style-image | The size of a 1em character |
border-image-source | The size of the element's border image area |
cursor | The browser-defined size matching the usual cursor size on the client's system |
mask-image | ? |
shape-outside | ? |
mask-border-source | ? |
symbols() for @counter-style | At risk feature. If supported, the browser-defined size matching the usual cursor size on the client's system |
content for a pseudo-element (::after/::before) | A 300px × 150px rectangle |
The concrete object size is calculated using the following algorithm:
Note: Not all browsers support every type of image on every property. See the browser compatibility section for details.
Browsers do not provide any special information on background images to assistive technology. This is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. If the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document.
<image> =
<url> |
<gradient>
<url> =
<url()> |
<src()>
<url()> =
url( <string> <url-modifier>* ) |
<url-token>
<src()> =
src( <string> <url-modifier>* )
url("test.jpg") /* A <url>, as long as test.jpg is an actual image */
linear-gradient(blue, red) /* A <gradient> */
element(#real-id) /* A part of the webpage, referenced with the element() function,
if "real-id" is an existing ID on the page */
image(ltr "arrow.png#xywh=0,0,16,16", red)
/* A section 16x16 section of <url>, starting from the top, left of the original
image as long as arrow.png is a supported image, otherwise a solid
red swatch. If language is rtl, the image will be horizontally flipped. */
cross-fade(20% url("twenty.png"), url("eighty.png"))
/* cross faded images, with twenty being 20% opaque
and eighty being 80% opaque. */
image-set("test.jpg' 1x, 'test-2x.jpg" 2x)
/* a selection of images with varying resolutions */
"no-url.jpg" /* An image file must be defined using the url() function. */
url("report.pdf") /* A file pointed to by the url() function must be an image. */
element(#fakeid) /* An element ID must be an existing ID on the page. */
image(z.jpg#xy=0,0) /* The spatial fragment must be written in the format of xywh=#,#,#,# */
image-set("cat.jpg" 1x, "dog.jpg" 1x) /* every image in an image set must have a different resolution */
| Specification |
|---|
| CSS Images Module Level 3> # image-values> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
image |
1 | 12 | 1 | 2 | 1 | 18 | 4 | 11 | 1 | 1.0 | 4.4 | 1 |
cross-fade |
17["Supports the original dual-image with percentage implementation only.", "See bug 40470742 for supporting the unprefixedcross-fade() function."] |
79["Supports the original dual-image with percentage implementation only.", "See bug 40470742 for supporting the unprefixedcross-fade() function."] |
No | 15["Supports the original dual-image with percentage implementation only.", "See bug 40470742 for supporting the unprefixedcross-fade() function."] |
10Supports the original dual-image with percentage implementation only.5.1Supports the original dual-image with percentage implementation only. |
18["Supports the original dual-image with percentage implementation only.", "See bug 40470742 for supporting the unprefixedcross-fade() function."] |
No | 14["Supports the original dual-image with percentage implementation only.", "See bug 40470742 for supporting the unprefixedcross-fade() function."] |
9.3Support for the original dual-image with percentage implementation only.5Supports the original dual-image with percentage implementation only. |
1.0["Supports the original dual-image with percentage implementation only.", "See bug 40470742 for supporting the unprefixedcross-fade() function."] |
4.4["Supports the original dual-image with percentage implementation only.", "See bug 40470742 for supporting the unprefixedcross-fade() function."] |
9.3Support for the original dual-image with percentage implementation only.5Supports the original dual-image with percentage implementation only. |
element |
No | No | 5729–57-moz-element() is limited to background-image, background, border-image and border-image-source. |
No | No | No | 6029–60-moz-element() is limited to background-image, background, border-image and border-image-source. |
No | No | No | No | No |
image-set |
11311320–113Support forurl images only and x is the only supported resolution unit. |
11311379–113Support forurl images only and x is the only supported resolution unit. |
899088–89Thetype() function is not supported as an argument to image-set(). |
999915–99Support forurl images only and x is the only supported resolution unit. |
171714–17Thetype() function is not supported as an argument to image-set().14–17Thetype() function is not supported as an argument to image-set().10.1–14Support forurl images only and x is the only supported resolution unit.6–14Support forurl images only and x is the only supported resolution unit. |
11311325–113Support forurl images only and x is the only supported resolution unit. |
899088–89Thetype() function is not supported as an argument to image-set(). |
767614–76Support forurl images only and x is the only supported resolution unit. |
171714–17Thetype() function is not supported as an argument to image-set().14–17Thetype() function is not supported as an argument to image-set().10.3–14Support forurl images only and x is the only supported resolution unit.6–14Support forurl images only and x is the only supported resolution unit. |
23.023.01.5–23.0Support forurl images only and x is the only supported resolution unit. |
1131134.4–113Support forurl images only and x is the only supported resolution unit. |
171714–17Thetype() function is not supported as an argument to image-set().14–17Thetype() function is not supported as an argument to image-set().10.3–14Support forurl images only and x is the only supported resolution unit.6–14Support forurl images only and x is the only supported resolution unit. |
paint |
65 | 79 | No | 52 | No | 65 | No | 47 | No | 9.2 | 65 | No |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/image