[css-images] image() function with conditions


I know that there already have been proposals to add another argument beside STRING or URL on image() to give the browser a hint if it supports an image format before loading it. Such as:

	background-image: image('image.webp' image/webp, 'image.png');

A browser with support of WebP would load the first image, another that doesn't wouldn't even start to load the first image to see if it can be used.
I like that idea, but think it can be extended. (Sorry if the following was proposed already, but I couldn't find a threat about it.)

What about allowing conditions within image()? Something like the proposed srcset attribute on <img> element:

	background-image: image('image-highDPI.png' 2x, 'image-lowDPI.png');

Or in combination with the first proposal:

	background-image: image(('image-highDPI.webp' image/webp 2x, 'image-highDPI.png' 2x, 'image-lowDPI.webp' image/webp, 'image-lowDPI.png');

In my opinion, image() gets more interesting with capabilities like that.


Received on Monday, 2 September 2013 05:42:38 UTC