W3C home > Mailing lists > Public > www-style@w3.org > September 2013

[css-images] image() function with conditions

From: Dirk Schulze <dschulze@adobe.com>
Date: Sun, 1 Sep 2013 22:42:11 -0700
To: www-style list <www-style@w3.org>
Message-ID: <9469E00B-4B36-4FA0-A0F2-606F98DCCA41@adobe.com>
Hi,

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.

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

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:34 UTC