View Full Version : CSS text - centering text 'vertically'

07-26-2007, 02:51 PM
Hi again folks,

This query should be a breeze for you professionals however I still cant quite work it out.

Is there a way to have text centred on a Div tag, not horizonatally though but vertically? i.e. equal space between top and bottom. I have created a footer div, which has a background colour and the text #footer p needs to be spaced equally (top and bottom), however I am having difficulty working it out. Have a overlooked something really glaring, I shall take it on the chin if it is really obvious.

Many thanks in advance.

08-01-2007, 05:34 AM
text {vertical-align: middle;}

change the red text to suit.

08-01-2007, 11:51 AM
vertical-align only vertically aligns inline elements. http://www.domedia.org/oveklykken/css-vertical-align.php

tommi would something like this work?
<div style="paddng: 50px auto; text-align: center; border: 1px solid #ccc; background #eee;">This text is centered and with equal top and bottom padding</div>