[whatwg] img as a layout tool to describe the displayed region of a CSS background-image

Tab Atkins Jr. jackalmage at gmail.com
Wed Apr 28 11:43:40 PDT 2010


On Wed, Apr 28, 2010 at 4:31 AM, Ingo Chao <i4chao at googlemail.com> wrote:
> http://dev.w3.org/html5/spec/Overview.html#the-img-element
> "The img must not be used as a layout tool. In particular, img
> elements should not be used to display transparent images, as they
> rarely convey meaning and rarely add anything useful to the document."
>
> An img with a given transparent image for src cuts an area of a sprite.
> ( = img as a layout tool to describe the displayed region of a CSS
> background-image.)
>
> Is this usage of the img element considered invalid (non-conforming)?

Yes, this is using the <img> as a layout tool.  Specifically, you're
using the <img> to avoid specifying "width" and "height" in CSS, and
to enable further layout hacks with sprites using
background-positioning.

~TJ


More information about the whatwg mailing list