View Full Version : Centering Text..help?


texasmandie
02-12-2004, 07:09 PM
Ok..how do you get text to center in the page, with CSS?

Amanda

Arc Angel
02-12-2004, 07:52 PM
For centering text horizontally you can either add style="text-align:center;" to your div or you can do the same thing by putting it in the HEAD section thusly:

<style type="text/css">
#yourdiv {
text-align: center;
}
</style>

In which yourdiv is the ID of the div you want to center.


If you'd like to align it vertically try going here (http://www.wpdfd.com/editorial/wpd0103.htm#toptip). Or search google for "vertical centering in CSS".

kittycat
02-12-2004, 09:40 PM
If you want the entire page to be centred try this:

To the body section add 'text-align: center;'

To any divs etc in your page add the following:
margin: auto;
You can also change that to
margin: 10px auto 30px auto;
The order is top-right-bottom-left. If the right and left are set to 'auto' then it should position horizontally.