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

Re: background-position-x & y

From: Jorrit Vermeiren <mercator+w3c@gmail.com>
Date: Tue, 20 Jan 2009 02:13:04 +0100
Message-ID: <bd6e15d00901191713j2f09a0a5v3a379b0ff14f62fc@mail.gmail.com>
To: "L. David Baron" <dbaron@dbaron.org>, "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: www-style@w3.org

On Wed, Jan 14, 2009 at 22:08, L. David Baron <dbaron@dbaron.org> wrote:
> On Wednesday 2009-01-14 12:41 -0800, fantasai wrote:
>> Agreed. sprite() is much preferable to extending url().
> I'm not sure "sprite" is really what we want to call it.  Maybe
> "image" or "image-region"?
> Anyway, my previous proposal from the last time this came up is in
> http://lists.w3.org/Archives/Public/www-style/2007Sep/0061.html

I see one possible drawback to this approach. Doing sprites now, you
typically only define the background image URI once, and only need to
specify the background-position property for all the alternatives
(e.g. see the first post in this thread:

Would such inheritance still be possible using this function notation?
For example:

/* top-left 10x10 sprite is the default: */
li { background-image: sprite(url(foo.png), 0px, 0px, 10px, 10px); }

/* 2nd and 3rd 10x10 sprites in first row for special cases: */
li#one { background-image: sprite(inherit,10px, 0px, 20px, 10px); }
li#two { background-image: sprite(inherit, 20px, 0px, 30px, 10px); }

/* hover states in second row: */
li:hover { background-image: sprite(inherit, inherit, 10px, inherit, 10px); }

The order of the coordinates I used is x-start, y-start, x-end, y-end,
for no particular reason. The exact syntax isn't important (and can
hopefully be improved upon), I just hope my intention is clear.

Received on Tuesday, 20 January 2009 01:19:40 UTC

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