W3C home > Mailing lists > Public > www-style@w3.org > January 2004

Re: position: center

From: Lachlan Hunt <lachlan.hunt@iinet.net.au>
Date: Tue, 27 Jan 2004 12:28:55 +1100
Message-ID: <4015BED7.5070104@iinet.net.au>
To: www-style@w3.org

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

   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.

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

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