Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The element()
CSS function defines an <image>
value generated from an arbitrary HTML element. This image is live, meaning that if the HTML element is changed, the CSS properties using the resulting value are automatically updated.
A particularly useful scenario for using this would be to render an image in an HTML <canvas>
element, then use that as a background.
On Gecko browsers, you can use the non-standard document.mozSetImageElement()
method to change the element being used as the background for a given CSS background element.