On Jul 13, 2011, at 1:47 AM, Joergen W. Lang wrote:

> .semi-transparent {
>  background: url('images/semi-transparent.png') grey;
>  background: rgba(50%,50%,50%,0.5);
> }
> 
> This is supposed to define a double-fallback:
> 
> * browsers that do understand rgba() use the second declaration
> * browsers that don't, ignore it and use the first one
> * browsers that can load the PNG will do so
> * otherwise they use a simple grey background

hmm, browser that (a) don't understand the png format or (b) don't load images 
will ignore your first line…
and with you first line, browsers that do load the png, but ignore the rgba 
background will have a semi transparent image over the grey background - a 
semi-transparent grey png on a grey background is :not([very visible]).

better

.semi-transparent {
 background: gray; /* <— official spelling, although browsers accept 'grey' [*] 
*/
 background: url('images/semi-transparent.png');
 background: rgba(50%,50%,50%,0.5);
}

> My questions are:
> Will browsers that understand rgba() still load the PNG?
Assuming the image isn't been used elsewhere on the page, in principle: NO.
A quick test with Opera 11.5, WebKit nightly and various Geckos tells me that 
is what those do. I tested by looking at my Apache access_log. I then verified 
this by looking at the network pane of Firebug and WebKit's WebInspector. You 
could also se the LiveHTTPheaders extension for Firefox, assuming it works in 
the Fx version you have (damn stupid fast release schedule).
 
> Any ideas to improve the above rule?
see above


[*] http://www.w3.org/TR/CSS21/syndata.html#color-units
    http://www.w3.org/TR/css3-color/#html4

Philippe
--
Philippe Wittenbergh
http://l-c-n.com/






______________________________________________________________________
css-discuss [[email protected]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to