Re: background-position-x & y

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 UTC