Re: [css3-images] image() notation and <img>

On Nov 21, 2012, at 1:09 AM, Daniel Glazman <daniel.glazman@disruptive-innovations.com> wrote:

> Can I write the following?
> 
>   <style>
>     #myDiv {
>       background-image: image('#myLogo');
>     }
>   </style>
> 
>   <div id="myDiv">....</div>
>   ....
>   <img id="myLogo" src="myLogo.png"/>
> 
> expecting the div will acquire the logo as background-image
> or should the target of image() here be an image format?
> I don't think the CSS Image Values and Replaced Content Level 3
> spec is clear enough about this in section 3.2 and it probably
> needs a clarification as a note or warning?

I think the spec is pretty clear about that:

"Each ‘<string>’ or ‘<url>’ inside ‘image()’ represents an image, just as if the ‘url()’ notation had been used."

You can not do what you did in your example. image() guarantees that you can use fragments in your URI as well as fallbacks, other then that it is the same like url(). What you maybe want is element(), but even that would draw the element <img> and not it's src reference.

Greetings,
Dirk

> 
> </Daniel>
> 

Received on Wednesday, 21 November 2012 16:52:17 UTC