On Tuesday 2006-09-19 02:37 -0400, Arian Hojat wrote:
> I was looking at some background positioning code that i never really
> thought about until recently...
> I was making a background image on a div with 'top left' declaration
> and was saying to myself... 'Okay for some reason CSS guys choose to
> do Y positioning 1st in the declaration and then X'.. Am i correct in
> thinking 'top center bottom' is related to Y positioning and 'left
> center right' is X positioning ?....
> 
> Then I was changing the code to center image vertically with
> percentage values and realized the declaration for non-keyword values
> looks like 'X% Y%' or 'Xpx Ypx'.  So X positioning comes first and Y
> next when not using keywords?
> 
> Why the heck did the css spec writers do this?
> So its like a 'center left' declaration is same as '0% 50%' but isnt
> it counterintuitive for the spec to be written this way?

Pixel and percentage values go in X-Y order.  However, unambiguous
keyword values are allowed to be in either order, and extra "centers"
can be omitted, so 'left', 'left center', 'center left' (the backwards
one), and '0% 50%' all mean the same thing.  In fact, as of CSS 2.1, the
values can be mixed, so 'left 50%' and '0% center' also mean the same
thing (but '50% left' is an error and 'center 0%' is equivalent to
'top').

I suspect it was done this way so that combinations that were easily
understandable by humans, like 'bottom left', were not CSS errors,
particularly since the normal English order for those words puts
top/bottom before left/right.

-David

-- 
L. David Baron                                <URL: http://dbaron.org/ >
           Technical Lead, Layout & CSS, Mozilla Corporation

Attachment: pgpXFVRk7dAjd.pgp
Description: PGP signature

______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7b2 testing hub -- http://css-discuss.incutio.com/?page=IE7
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to