CSS image() Function

The CSS image() function allows you to specify an image with fallback options and annotations.

The image() function provides similar functionality to the url() function, with the added ability to do the following:

Official Syntax

The image() function is currently defined in the CSS Image Values and Replaced Content Module Level 4 (W3C Working Draft). It specifies this syntax:

image-tags

These allow you to specify a directionality for the image. For example, if the image is an arrow that represents a bullet point that points into the content, you can use this setting to ensure the arrow always points the correct way, whether the text is LTR or RTL.

ltr
Specifies left to right. For example, image(ltr "arrow.png").
rtl
Specifies right to left. For example, image(rtl "arrow.png").

image-src

Specifies the source of the image.

url
Specifies an image as a valid url value.
string
Specifies an image as a valid string value.

color

Represents a solid-color image of the given color with no intrinsic dimensions. This color can be used as an ultimate fallback in the event that none of the specified images can be displayed.

CSS Specifications

Browser Support

The following table provided by Caniuse.com shows the level of browser support for this feature.