Re: Horizontal alignment of blocks

Arthur Wiebe wrote:

> Mikko Rantalainen wrote:
>> Well, the user agent would need to map that "align" property to 
>> margins anyway or it wouldn't make any sense (think "align: center" 
>> combined with "margin-left:0; margin-right: 90%;" What should the user 
>> agent do?).
>>
>> So basically we would create new property "align" with possible values 
>> of "left", "right" and "center". And all it would do, is to interpret 
>> those as "margin-left: 0; margin-right: auto;", "margin-left: auto; 
>> margin-right: 0;" and "margin-left: auto; margin-right: auto;" 
>> respectively. Yes, it would allow shorter style declaration /in some 
>> cases/ but in the same time, it would add some bloat to all user agents.

> Is margin made for alignment? Maybe align would be confusing. I have 
> thought about it. Since we do have vertical-align why don't we also add 
> horizontal-align? It would be more typing but less confusing. Since we 
> do have vertical-align it would make sense to also have 
> horizontal-align. As far as bloating the browser I don't think 
> horizontal-align would do any bloating. Did vertical-align bloat some 
> browers?

The spec 
<URL:http://www.w3.org/TR/REC-CSS2/visudet.html#propdef-vertical-align> 
says:

vertical-align

   This property affects the vertical positioning inside a line
   box of the boxes generated by an inline-level element.

Notice the "line box" part. The vertical-align property is vertical 
equivalent to "text-align". Remember how I said, the difference between 
"text-align" and this new 'align' must be understood?

The problem, as I see it, is the way top and bottom margins are 
calculated. I think that if I have a block that's sized (10em,20em) and 
another block inside it sized (5em,10em) then setting "margin:auto" for 
that inner block should center it both horizontally and vertically 
inside the containing block. This isn't what current browsers do and I'm 
not sure if it's because the spec (that isn't too clear) or just a 
shortcoming of browser manufacturers. Or perhaps I've misunderstood how 
vertical-align is supposed to work.

[-> www-style@w3.org]

-- 
Mikko

Received on Thursday, 5 June 2003 04:03:50 UTC