W3C home > Mailing lists > Public > www-style@w3.org > November 2012

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

From: Dirk Schulze <dschulze@adobe.com>
Date: Wed, 21 Nov 2012 08:51:40 -0800
To: Daniel Glazman <daniel.glazman@disruptive-innovations.com>
CC: "www-style@w3.org" <www-style@w3.org>
Message-ID: <9FE551DC-F86E-4F21-A9DA-028D88AA3C60@adobe.com>

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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:02 GMT