Re: [CSS3] content, background-image and fallbacks

Giuseppe Bilotta wrote:
> Hello all,
>
> I've recently found myself considering what kind of fallback
> capabilities current web standards offer, in case where referenced
> content is either unavailable or unsupported by user agents. The
> situation is not particularly nice, although some form of fallback
> support is being built e.g. in HTML5 with the 'source' tag for audio
> and video (although it is not being added to img, which is a pity; but
> anyway, that's for another place to discusse).
>
>   
...

I am using[1] :incomplete and :busy state flags exposed to CSS.

:busy - element has active download requests to external resources (e.g. 
all kind of images, document data in <frame>, etc.)
:incomplete - some of data needed for the element (list above) is not 
delivered in full or one of requests has failed.

Therefore these rules:

img:busy {  background-image: url(stock:activity-spin.png);  }
img:not(:busy):incomplete {  background-image: 
url(stock:image-not-available.png); content: attr(alt);  }

define what most of UAs are doing when image is not available.

In general selector :
something:not(:busy):incomplete {...}
can be used to trigger fallback rendering when some images defined by 
element style are not available.

Practice shows that most of cases this is enough.

[1] http://www.terrainformatica.com/htmlayout/main.whtm

-- 
Andrew Fedoniouk.

http://terrainformatica.com

Received on Wednesday, 19 August 2009 22:14:11 UTC