|
Posted by Ben C on 10/27/06 11:25
On 2006-10-27, CRON <cronoklee@hotmail.com> wrote:
> Hi all,
> Anyone come across a simple, cross-browser compatible way of aligning a
> table to the vertical centre of a page?
> Cheers,
> Ciarαn
It should work to do:
table
{
position: absolute;
height: 200px;
top: 0px;
bottom: 0px;
margin: auto 0;
}
For vertical centering to work, top, bottom and height must all be set
to lengths, and top and bottom margins to auto.
But this doesn't work in Firefox. The spec is a little ambiguous, but
something with display: table should really behave on the outside like a
block box.
You can set the same bunch of properties on a div instead, and put the
table inside the div. That works in FF.
The downside here is you need to set the height-- you can't vertically
centre a table with auto height.
Navigation:
[Reply to this message]
|