Re: Stand-in color before images load

Laurens Holst wrote:
> Matthew Raymond wrote:
>>  Perhaps what we need is "alt" styling...
>>
>>| p { background: transparent url("marble.png"); }
>>| p:alt { background-color: black; }
> 
> I don’t know if that would work...
> 
> p { background: transparent url("marble1.png");
>      content: url("marble2.png"); }
> p:alt { background-color: black; }
> 
> When will the :alt be visible, marble1.png fails to load, or 
> marble2.png, or both?

    I guess both. Just ":alt" would be a general file load failure. 
Really, what we need is to be able to feed a property name to :alt to 
pick a specific property that triggers the alternative styling.

| p {
|   background: transparent url("marble1.png");
|   content: url("marble2.png");
| }
|
| p:alt(background-image) { background-color: black; }
| p:alt(content) { content: "Image failed to display: marble2.png"; }
| p:alt(background-image):alt(content) { color: white; }


> Also, this is just about images not loading, right?

    I suppose it could be generalized to files not loading...

 > There are a limited amount of /properties/ with which you can
> load images. Is it logical to ‘fix’ something done by properties with a 
> selector?

    It is if you want something more sophisticated than a canned, single 
property solution.

> Wouldn’t it be easier to introduce an equally limited amount 
> of properties for this specific functionality?

   Not necessarily. Depends on the user agent architecture and the 
nature of the new properties. If you have to test to see if the 
properties apply, though, I would assume you could roll that test into a 
CSS selector.

 > Also, I think this would
> then be the first selector which becomes valid based on the state of CSS 
> itself. What if you load an image inside an :alt selector?

    Forbid image loading for properties of :alt. There's no reason to 
have them anyways, since the idea is that the images can't be loaded.

    Then again, you could have situations where a specific image format 
won't load. I think that perhaps a different solution would be better 
for that, though. Perhaps something like this:

| p { background: transparent url("marble.png", "marble.gif"); }

> Replace the p with img and you’ve got an even more complex case.

    :alt(self)???

Received on Tuesday, 29 March 2005 21:22:45 UTC