View Full Version : Centering (vertically)


reddragon8
04-10-2005, 01:25 PM
How can i center my layout (vertically)? I've centered it horizontally, using the <center> tags.

[ http://www.reddragons.secretsomebody.com ]

kiwee
04-10-2005, 02:07 PM
<p align="center" valign="center">
...
</p>

reddragon8
04-10-2005, 02:14 PM
Thanx :)

pb&j
04-10-2005, 02:50 PM
first you would have to set the height of the container tag to 100%, then you can valign it to the middle (not center).

<div style="height:100%; text-align:center; vertical-align:middle;">
stuff here
</div>

kiwee
04-10-2005, 03:28 PM
same thing :D

pb&j
04-10-2005, 03:36 PM
valign and vertical-align will have the same effect, yes, but the value still must be middle, not center, to work correctly in more browsers.

align -- left, center, right
valign -- top, middle, bottom

also, if a height is not specified, it would may be hard for the coding to determin how big the area is and thus vertically center the contents. if the height is being determined by another entity, then that is a different story.

kiwee
04-10-2005, 09:03 PM
oh, ok