You are here: Re: vertical alignment « HTML « IT news, forums, messages
Re: vertical alignment

Posted by Ben C on 03/20/07 15:50

On 2007-03-20, Spartaco <boh@boh.voh> wrote:
> Hi, this is a big problem for me I can't solve it: I have a <div>, and I
> want the content of this div be vertically aligned in the middle by applying
> CSS styles to the div tag... I've tried the vertical-align but it does not
> work, the content is always at the top.

vertical-align aligns the inline contents of the div with respect to the
lines they're on, not with respect to the total height of the div.

You could set line-height on the div to the div's own height, but if the
lines break you will get an unwanted effect.

Your best option may be to use a table cell instead of a div (or apply
display: table-cell to the div). vertical-align on a table cell means
what you expect.

 

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

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация