img
with srcset
attribute looks like a great way of doing responsive images. Is there an equivalent syntax that works in css background-image
property?
HTML
<img src="small.jpg" srcset="medium.jpg 1000w, large.jpg 2000w" alt="yah">
CSS
.mycontainer {
background: url(?something goes here?);
}
image-set
is the equivalent CSS feature. We should add equivalent srcset functionality (defining resources according to their dimensions) to the spec.
Currently it's only implemented in Safari, Chrome and Opera with the -webkit-
prefix, and it only supports the x
descriptors.