W3C home > Mailing lists > Public > www-style@w3.org > August 2009

Re: Image sprites use cases

From: Alex Kaminski <activewidgets@gmail.com>
Date: Sun, 30 Aug 2009 21:25:24 +0200
Message-ID: <6328fb9a0908301225q63993720nde892fe235246435@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: www-style@w3.org
Boris Zbarsky<bzbarsky@mit.edu> wrote:
> Alex Kaminski wrote:
>>
>> The checkbox image should reflect the value (checked, unchecked,
>> mixed) and the control state (normal, hover, pressed, disabled).  That
>> is 12 images and I would rather not have them in separate files, and
>> use image sprites instead.
>
> Is the right solution here image sprites plus a new complex CSS spec
> feature, or some sort of packaging format that gives you the main benefit of
> image sprites (only having to make one HTTP request to get ll the images)
> plus a new feature to support this packaging format in browsers?  Or is your
> usecase not addressed by the latter for some reason?
>

IMHO there are two important components for the right solution -

1. to make single HTTP request instead of multiple ones.

In this regard the composite image + CSS are equivalent to some new packaging
format. There might be minor advantages for each method in some
particular cases,
for example, I would prefer to store button parts as a composite image but
I would also prefer to store multiple icons as a package of separate images.
But these are really very minor differences.

2. to have flexible 'multi-dimensional' fragment addressing scheme.

This is important one. The current practice of using background-position-x/y
combined with image URL allows 3 independent parameters, so we can refer to the
part (for example, corners/sides/fill), state (normal/hover/pressed/disabled)
and variants (OS specific look, size, etc) independently. Ideally the addressing
scheme for for the packaging format should allow splitting the fragment address
to multiple parts and map them to different CSS properties. I cannot yet
imagine how this might be done - looks very unnatural.

-- 
Alex Kaminski
http://www.activewidgets.com
Received on Sunday, 30 August 2009 19:26:05 GMT

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