W3C home > Mailing lists > Public > www-style@w3.org > December 2007

RE: Alignment property proposal

From: Markus Mielke <mmielke@microsoft.com>
Date: Fri, 28 Dec 2007 08:10:28 -0800
To: Andrew Fedoniouk <news@terrainformatica.com>, Anne van Kesteren <annevk@opera.com>
CC: fantasai <fantasai.lists@inkedblade.net>, "www-style@w3.org" <www-style@w3.org>
Message-ID: <F9CFAB67561FF84EB590E4979F8468971331384CB7@NA-EXMSG-C124.redmond.corp.microsoft.com>
Flex unit is a great idea. My concern is that if you do not specify explicitly (something like "alignment: horizontal") CSS becomes more and more obscure and harder to use. One of its strength today is mostly it’s descriptiveness (at least in the property names less so in the selector syntax).

-- MM

-----Original Message-----
From: Andrew Fedoniouk [mailto:news@terrainformatica.com]
Sent: Wednesday, December 26, 2007 9:29 PM
To: Anne van Kesteren
Cc: fantasai; Markus Mielke; www-style@w3.org
Subject: Re: Alignment property proposal

Anne van Kesteren wrote:
> On Wed, 26 Dec 2007 09:44:44 +0100, Anne van Kesteren <annevk@opera.com>
> wrote:
>> I think it would be good if one of these features exactly matches the
>> behavior of <center>. (I thought that was the idea behind the
>> proposal, at least for some proponents.) It seems that WebKit and
>> Gecko have implemented that as text-align:-webkit-center and
>> text-align:-moz-center respectively. Maybe we should introduce
>> block-center as a value for text-align.
> As for vertical centering and horizontal centering in general, I think
> we should more seriously look into the flexible box model as featured by
> XUL. Maybe combining it with the Advanced Layout Module in some way as
> Roc suggested if that's at all feasible. I think that would solve a
> bunch of layout issues people are currently running into and hacking
> around using 'float', 'position', and probably script.

XUL flexes are not so suitable for CSS as they describe only
width/height of elements but for aligning purposes you need flexes
to be applied to margins for example.

For CSS it is better to use so called "flex units" [1,2]:

Following will replace blocks vertically (as usual) and center them

body > *
   margin-left; 1*;
   margin-right; 1*;

and this:


body > *
   margin-top; 1*;
   margin-bottom; 1*;

will replace blocks in single row and center them vertically.

And this:

body > *
   margin-top; 0;
   margin-bottom; 0;

will replace blocks in single row and make their height equal to each
other - to the height of tallest element in the row (similar to cells in
single row table).

Andrew Fedoniouk.


[1] 'flex' units:

[2] The 'flow' attribute:

Received on Friday, 28 December 2007 16:11:44 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:32 UTC