Click to See Complete Forum and Search --> : table aligning with css


minulescu
12-08-2002, 07:58 PM
Is it possible to align a table, or anyother object for that matter, vertically in the middle? I'm going to make a page that's not going to be more than 800x600. So, i want to vertically align my table with all the content in in the center of the window, even if the resoltuion is changed to lets say 1024x768. Is this possible with css.
Thanks

Zach Elfers
12-08-2002, 08:27 PM
position:absolute;left:50%;top:50%;

Stefan
12-09-2002, 05:35 AM
Originally posted by minulescu
[B]Is it possible to align a table, or anyother object for that matter, vertically in the middle?

Only if you know it's exact height & width, (unless it's a background image).

eg
position:absolute;left:50%;top:50%; width:200px; height:300px; margin:-150px 0 0 -100px;


BTW, you shouldn't be using <table> for creating general layout in the first place.

minulescu
12-09-2002, 03:34 PM
I know i shouldnt be using table for alignment, but i dunno too much about css, so I'm gonna "abuse" tables, like U usually say Stefan :) . I know i shouldnt but hey, what can I do. I'm gonna use what I can and know how to use. I have one question tho. If u set the margin, like you did above, is that only for the item/object specified?? or does it change my whole page to that margin?
Thanks

Stefan
12-09-2002, 05:34 PM
Originally posted by minulescu
. I have one question tho. If u set the margin, like you did above, is that only for the item/object specified??

Yes, you want to specify it for the specific object you want to center.