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

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 21 Nov 2012 10:02:18 -0800
Message-ID: <CAAWBYDAfcbAjmitDnq-FDy3ffEb6MzQvUa-2ABUZexZdTWfbew@mail.gmail.com>
To: Daniel Glazman <daniel.glazman@disruptive-innovations.com>
Cc: "www-style@w3.org" <www-style@w3.org>
On Wed, 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?

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.

~TJ
Received on Wednesday, 21 November 2012 18:03:06 GMT

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