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

Re: Background position

From: Sophie <sophie.gousset@laposte.net>
Date: Wed, 17 Jun 2009 15:16:47 +0200
Message-ID: <4A38ECBF.5030202@laposte.net>
To: Bert Bos <bert@w3.org>
Cc: www-style@w3.org


Bert Bos wrote:
> On Monday 18 May 2009, Henrik Hansen wrote:
>> Correct me if I'm wrong, but didn't we discuss this recently. If so
>> what was the conclusion.
>
> It's issue-9 in the database:
> http://www.w3.org/Style/CSS/Tracker/issues/9
>
> The WG agreed to close the issue. The use case of making "sprites"
> easier wasn't considered enough to complicate CSS for. The benefit of
>
>     background-position-y: -30px
>
> over
>
>     background-position: 0 -30px
>
> isn't huge.

Hello,

I was thinking of the benefit of :

#subNav li a {
	background:url("../images/about.gif") no-repeat 0 0;
}
#subNav li#sub2Link a {
	background-position-x:-165px;
}
#subNav li#sub3Link a {
	background-position-x:-330px;
}
#subNav li#sub4Link a {
	background-position-x:-495px;
}
#subNav li a:hover, #subNav li a:focus {
	background-position-y:-50px;
}
#subNav li a:active {
	background-position-y:-100px;
}


over

#subNav li a {
	background:url("../images/about.gif") no-repeat 0 0;
}
#subNav li#sub2Link a {
	background-position:-165px 0;
}
#subNav li#sub3Link a {
	background-position:-330px 0;
}
#subNav li#sub4Link a {
	background-position:-495px 0;
}
#subNav li#sub1Link a:hover, #subNav li#sub1Link a:focus {
	background-position:0 -50px;
}
#subNav li#sub2Link a:hover, #subNav li#sub2Link a:focus {
	background-position:-165px -50px;
}
#subNav li#sub3Link a:hover, #subNav li#sub3Link a:focus {
	background-position:-330px -50px;
}
#subNav li#sub4Link a:hover, #subNav li#sub4Link a:focus {
	background-position:-495px -50px;
}
#subNav li#sub1Link a:active {
	background-position:0 -100px;
}
#subNav li#sub2Link a:active {
	background-position:-165px -100px;
}
#subNav li#sub3Link a:active {
	background-position:-330px -100px;
}
#subNav li#sub4Link a:active {
	background-position:-495px -100px;
}

Which gets huger and huger as you add menu elements.

The first seems also easier to read and maintain to me (no multiple
values to edit to change one state position everywhere in the menu).

Regards,

Sophie


-- 
 ______________________________________________________________
| S O
| P H-                http://sophie-g.net/
|_I_E__________________________________________________________
Received on Wednesday, 17 June 2009 13:17:27 GMT

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