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

Re: Image sprites use cases

From: Robert O'Callahan <robert@ocallahan.org>
Date: Sun, 30 Aug 2009 17:08:42 -0700
Message-ID: <11e306600908301708s21efbfeblb6d2675a4bc08068@mail.gmail.com>
To: Brad Kemper <brad.kemper@gmail.com>
Cc: "Tab Atkins Jr." <jackalmage@gmail.com>, Alex Kaminski <activewidgets@gmail.com>, www-style@w3.org
On Sun, Aug 30, 2009 at 4:59 PM, Brad Kemper <brad.kemper@gmail.com> wrote:

> On Aug 30, 2009, at 4:20 PM, Robert O'Callahan wrote
> On Sat, Aug 29, 2009 at 3:07 PM, Tab Atkins Jr. <jackalmage@gmail.com>wrote:
>> (I'll note quickly that my favorite, and I think generally the best
>> solution, is the one being created by the Media Fragments WG where
>> they're defining one form of hash on links to image files.  Using frex
>> "image.png#xywh=0,40,20,20" would select a 20x20 region, starting on
>> the left edge, 40px from the top.
> The problem with that approach is that it doesn't degrade gracefully for
> browsers without the feature.
> Wouldn't "image.png#xywh=0,40,20,20" be treated the same as "image.png" in
> UAs that did not support the special meaning of the hash value,

It would, which is the problem...

> leaving you with a single image to use for everything, just as with UAs
> that didn't support "-moz-image-rect()"?

Yes, the problem is that there is no way to specify an alternative small
image as fallback...

background: url(image-small-05.png);
background: -moz-image-rect(image.png,0,40,20,20);
browsers not supporting the feature use url(image-small-05.png) for the
image and everything's good.

But given
background: url(image-small-05.png);
background: url(image.png#xywh=0,40,20,20);
browsers not supporting the feature will use url(image.png) for the image
and the page is broken. You obviously can't use background-position
conditionally here.

"He was pierced for our transgressions, he was crushed for our iniquities;
the punishment that brought us peace was upon him, and by his wounds we are
healed. We all, like sheep, have gone astray, each of us has turned to his
own way; and the LORD has laid on him the iniquity of us all." [Isaiah
Received on Monday, 31 August 2009 00:09:22 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:07:38 UTC