Re: position: center

Ian Hickson wrote:
> On Sun, 25 Jan 2004, Vincent Starre wrote:
>>what would position:center be relative to?
> 
> The containing block, as with position:absolute (see CSS2.1 section 10.1).
> 
> Here is an updated version of the position:center proposal. Comments
> welcome.
> 
> position: center
> ----------------
> 
> With this proposal, the following rule:
> 
>    body { position: center; }
> 
> ...would be enough to center a typical HTML document in the viewport.

   Personally, I don't like this proposal to use the position property
for centering.  In the above example, I can't understand whether it is
applying to the body element, or whether it is applying to the body
element's content.  Also, this property would the element both
horizontally and vertically, however it may be that only vertical
positioning is required.

   There already exists a way to center content horizontally using the
text-align property and there needs to be a similar property that works
vertically, which accepts the four values: top, middle (or center?),
bottom and justify.

   This property would work similarly to text-align, except it is
applied vertically instead of horizontally and could therefore be called
text-v-align.

   The combination of these two properties would allow an elements
content to be positoned anywhere within the block including:

|-----------------------------------------------|
|[top left]       [top center]       [top right]|
|                                               |
|[middle left]   [middle center]  [middle right]|
|                                               |
|[bottom left]   [bottom center]  [bottom right]|
|-----------------------------------------------|

plus vertical and horizontal justify properties which are harder to
illustrate using plain text.

CYA
...Lachy!

Received on Monday, 26 January 2004 20:37:01 UTC