Help - Search - Members - Calendar
Full Version: Vertically center text within a div.
HTMLHelp Forums > Web Authoring > Cascading Style Sheets
NovaArgon
How do I vertically center text or add padding to it without moving the whole div?

Right now the text is sitting on the bottom of the div.


CODE
#footer {
    color: #FFFFFF;
    background: url(images/bottom.jpg) repeat-x;
    font-weight: bold;
}



Thanks
Beakers
Could just go with:

#footer span{
top-margin:-20px;
}

then just place your footer text in a <span></span> and it will be moved up by 20px.

Without seeing the source and the reason its moving your text to the bottom of the div I cant suggest much else.

Iain
Frederiek
See http://www.w3.org/Style/Examples/007/center
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.