W3C home > Mailing lists > Public > www-style@w3.org > November 2008

Re: background-position-x & y

From: Jethro Larson <jethrolarson@gmail.com>
Date: Thu, 13 Nov 2008 02:01:29 +0000
Message-ID: <a9b1b1f20811121800q1d035654nc7d187697728409f@mail.gmail.com>
To: www-style@w3.org
On Wed, Nov 12, 2008 at 5:42 PM, Sylvain Galineau <sylvaing@microsoft.com>wrote:

> Is the description of sprites the only or main use-case for this feature ?
>

Certainly not. The main use-case really is *_not having specify both
horizontal and vertical just to specify one*_.
I used sprites as an example because it was a case where being able to
specify them separately significantly reduced css complexity.

Typical use-case could be as simple as wanting to push a background down a
few pixels for a particular element.

div#box{
  background: url(bg.png) no-repeat 20px 0;
}
div#box.aside{
  background-position-y: 10px;
}

Compare to:

div#box{
  background: url(bg.png) no-repeat 20px 0;
}
div#box.aside{
  background-position: 20px 10px;
}

Obviously there's not a lot gained in this use case. But at least you can
rely on the cascade for the horizontal property rather than duplicate it.
Obviously its best to stay DRY(Don't Repeat Yourself)
Received on Wednesday, 26 November 2008 13:14:31 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:17 GMT