You are here: Re: table vertically aligned centre on page ? « HTML « IT news, forums, messages
Re: table vertically aligned centre on page ?

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]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация