Re: [css4-background] background-position-x and background-position-y or logical directions

21.06.2012, 18:55, "Florian Rivoal" <florianr@opera.com>:
> * They can be simulated with variables, so we can live without them:
>
> For instance, here is a typical example of how they are used:
> šš.icon { background: url(sprite.png) 0 0 no-repeat; }
> šš#a { background-position-y: 0; }
> šš#b { background-position-y: -30px; }
> šš#c { background-position-y: -60px; }
> šš.icon:hover { background-position-x: -30px; }
> šš.icon:active { background-position-x: -60px; }
>
> This can be rewritten with variables:
> šš.icon { background: url(sprite.png) var(bg-x, 0) var(bg-y, 0) no-repeat;}
> šš#a { var-bg-y: 0; }
> šš#b { var-bg-y: -30px; }
> šš#c { var-bg-y: -60px; }
> šš.icon:hover { var-bg-x: -30px; }
> šš.icon:active { var-bg-x: -60px; }

Cannot say for others, but for me first example is much more clear.

By the way, very important factor is that background-position-x/-y are supported by IE which is the browser that's updated most slowly. Considering Microsoft's current tactics to release new versions of IE solely for new versions of Windows (no IE>8 for Windows XP, no IE>9 for Windows Vista), IE will continue to update slowly and therefore be painful and blocking new features to be widely used in the wild.

So there is huge difference between adding new feature (variables) and reusing existing one (background-position-x/-y) supported in all IE versions. Any non-IE browser will be updated quite quickly, and we could easily start using background-position-x/-y, say, in a year. On the contrary, we will in fact not be able to use variables until they are implemented in IE which updates very slowly unlike any other browser.

Received on Thursday, 21 June 2012 15:34:16 UTC