[whatwg] Built-in image sprite support in HTML5

Ian Hickson ian at hixie.ch
Tue Aug 3 17:19:45 PDT 2010


On Fri, 21 May 2010, David Weitzman wrote:
>
> There are various approaches to using image sprites with HTML and CSS, 
> but at the end of the day they are all essentially hacks. A solution 
> that would be simpler than any existing approach would be to introduce 
> new attributes for <img> to specify x and y offsets and clipping on 
> images. With that you would get simpler markup for sprites and better 
> accessibility.
> 
> One downside of this approach is that with background image sprites you 
> can have a CSS class that abstracts away the name of the sprite image. 
> With <img> tags you would have to specify the URL and height/width 
> individually on every sprited image.

I think the right solution is a fragment identifier.


On Sat, 22 May 2010, Silvia Pfeiffer wrote:
> On Sat, May 22, 2010 at 3:23 AM, Tab Atkins Jr. <jackalmage at gmail.com> wrote:
> >
> > The Media Fragments WG has a draft spec out for, well, Media 
> > Fragments, which let you specify which section of an image you want 
> > right in the url.  The browser should then automatically cut it out 
> > and serve just the sprite you want.
> 
> Yes, I was going to suggest that spec, too, see
> http://www.w3.org/2008/WebVideo/Fragments/WD-media-fragments-spec/#naming-space
> 
> However, what exactly happens with a media fragment URI like
> http://example.com/picture.png#xywh=160,120,320,240 is not fully
> specified in the Media Fragment URI spec.

I would recommend fixing that. :-)

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


More information about the whatwg mailing list