Centering text and other elements can easily be done with the CSS text-align property. It can be applied to a division, the p tag – pretty much any block-level element.
Applying this to an internal or external stylesheet:
p {text-align: center;}
or this to inline styling:
<p style="text-align: center;">This is centered text</p>
will center your text.
Tags: centering text
This post was written by: Andrea BarnettThis entry was posted on Tuesday, June 29th, 2010 at 12:29 am and is filed under CSS Basics, CSS Misc, CSS Page Layouts, Killer CSS Tips and Tricks. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.


