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

Re: positioned elements: center

From: John Oyler <johnoyler.css@gmail.com>
Date: Sat, 5 Jan 2008 21:31:02 -0500
Cc: Brad Kemper <brkemper@comcast.net>
Message-Id: <75ADF55E-15BF-4631-A658-72327E47C1E1@gmail.com>
To: CSS <www-style@w3.org>

On Jan 5, 2008, at 8:02 PM, 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 like this in principle, especially since you could use those  
independently of each other, or in conjuction with left/right/top/ 
bottom. Bottom centering, or left centering seems a good use. But I  
don't like center-$ where $ is the direction. Is that already part of  
other property names? If so, I guess you'd stick with convention. But  
if not, even though I dislike it, I don't have any good alternatives.

Also, what are the implications of implementing this? With absolute  
positioning where it doesn't affect the flow of other elements, it  
seems like there'd not be any algorithmic trouble, but maybe I'm  
missing something...\

John Oyler
Received on Sunday, 6 January 2008 02:31:11 UTC

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