PDA

View Full Version : Centering a Block of Text


crockett
Mar-16-2007, 10:53 AM
How do I do the following in HTML/CSS Land?

Ex. I have the following text:

XXXXX
X
XXX

If I use <center></center> I get:
XXXXX
X
XXX



But I want:XXXXX
X
XXX


^^^^^^^^^^^
The above should be more centered, I didn't put in enought tabs.

The block doesn't need to be perfectly centered but close would be great. I could even live with having the whole block tabbed over a few times.


Or course, I need it work in both FF and IE.

Thanks,

David

richW
Mar-16-2007, 06:52 PM
Something like this:

html
<div id="my_text">
Aenean dapibus nisi eget augue. Vestibulum vel augue. Fusce vitae nisi. Nam et lacus. Sed commodo, lacus ac ultricies aliquet, metus urna semper pede, nec faucibus quam odio non enim.
</div>

css
#my_text {margin-left: 375px;}

Post a link to your page so we can take a look.
And if needed adjust to your taste........

crockett
Mar-16-2007, 09:41 PM
Something like this:

html
<div id="my_text">
Aenean dapibus nisi eget augue. Vestibulum vel augue. Fusce vitae nisi. Nam et lacus. Sed commodo, lacus ac ultricies aliquet, metus urna semper pede, nec faucibus quam odio non enim.
</div>

css
#my_text {margin-left: 375px;}

Post a link to your page so we can take a look.
And if needed adjust to your taste........

Thanks. My page has since changed and I don't need this code but it sure does help me grab the html thing and I appreciate your reply.