W3C home > Mailing lists > Public > www-style@w3.org > March 2005

Re: Stand-in color before images load

From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
Date: Thu, 31 Mar 2005 00:19:01 +1000
Message-ID: <424AB555.6080608@lachy.id.au>
To: Laurens Holst <lholst@students.cs.uu.nl>
CC: www-style@w3.org

Laurens Holst wrote:
> 
> Anne van Kesteren wrote:
> 
>>> <h1 src="heading1.jpg"><em>Surely</em> this would be cool to have</h1>
>>
>> I assume h1:alt would still match the H1 element if image loading was 
>> somehow prevented.

It wouldn't be necessary, doesn't this
   h1[src] { content: attr(src,url); }
already fallback to the normal content when that's not available?


> Oh, stupid me :). h1:alt would even be nice to render a reddish border 
> or something around the element, to indicate something has failed loading.

I don't think so.  If there are styles that need to be applied to the 
elements content, but not when it's a replaced element, something like 
this would work:

   h1[src] { content: attr(src,url); }
   h1::inside { border: 5px dotted red; background-color:blue;
                color: lime; }

This gives both a fallback background colour, as requested by Barry in 
the initial post, the reddish border Laurens wanted, and whatever else 
you want.

Although that's not possible yet, why is there only ::outside and not 
::inside defined in CSS3 selectors?  However, the same result could be 
achieved by polluting the markup with:
   <h1 src="..."><span>...</span></h1>

> So, let’s say :alt (or rather: :loadfail?)

I don't think a pseudo-class is appropriate for this because this would, 
in a way, be a case of the selectivity of a selector being dependant 
upon other styles being applied or not, which no other selector does and 
nor should they.

-- 
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/     Rediscover the Web
http://GetThunderbird.com/ Reclaim your Inbox
Received on Wednesday, 30 March 2005 14:19:09 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:36 GMT