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

On Wed, Nov 21, 2012 at 1:09 AM, Daniel Glazman
<> 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?

As Dirk says, no.  That will load the current url + the hash as an
html page, which is not a valid image format.  In all CSS properties,
image("foo") and url("foo") will act the same.

Once I have time to revisit Images 4 and properly spec out element()
again, you'll be able to write "background-image: element('#myLogo')"
and it'll work as you expect.


Received on Wednesday, 21 November 2012 18:03:06 UTC