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

Re: positioned elements: center

From: fantasai <fantasai.lists@inkedblade.net>
Date: Mon, 07 Jan 2008 14:36:41 -0500
Message-ID: <47827F49.9050702@inkedblade.net>
To: Brad Kemper <brkemper@comcast.net>
CC: CSS Style <www-style@w3.org>

Brad Kemper wrote:
> I don't know if this subject has been broached before...
> 
> Using absolute positioning to center an element is not as simple as it 
> should be. I can position the element by setting its top, bottom, right, 
> and left. But if I set "left:50%; top:50%;", but to center the whole 
> element (instead of just the top left corner) I have to know its height 
> and width, divide them in half, and use them as negative margin. It 
> would be much simpler if I could set "*center-x:*50%; *center-y:*50%" 
> instead of top, left, and negative margin. 
> 
> I know there are a couple of other ways to get the items to center, but 
> they are no simpler, or have other limitations. Being able to position 
> items by center would be so much simpler.

There was a proposal for pretty much exactly this functionality quite awhile
ago, with slightly different syntax
   http://lists.w3.org/Archives/Public/www-style/2004Jan/0218.html

~fantasai
Received on Monday, 7 January 2008 19:36:52 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:57 GMT