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

[css4-images] Add format() hints to image()

From: Jake Archibald <jaffathecake@gmail.com>
Date: Thu, 14 Feb 2013 10:40:22 +0000
Message-ID: <CAJ5xic-QiJH+XiHEfo9rM2ms5vs7uquW=KwuA1kzM+-YKRu1uQ@mail.gmail.com>
To: W3C CSS Mailing List <www-style@w3.org>
The problem: image('whatever.webp', 'whatever.png')

If the browser doesn't support webp it will still download 'whatever.webp'
and attempt a decode before it'll fallback to the png. It could exit early
when it gets the content-type header, but that's still more network
activity than ideal.

Solution: Introduce format(), from @font-face


The browser wouldn't bother with the webp if it doesn't understand it. Like
fonts, format isn't limited to mime types, allowing for
format('webp-progressive'), if webp ever gets a progressive format.

The formats would be defined by the spec, as with fonts.

Alternative solution: format fragment


We already use the fragment for media fragments, could use it for format
too. However, this creates repetition in image-set. Meh.

Another alternative: Look at the 'extension'

Could look at the suffix of the url. This has repetition in image-set as
above, but also feels clunky, especially for format sub-types, eg
Received on Thursday, 14 February 2013 10:40:49 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:24 UTC