Jump to content

Centering A Block Of Justified Text Within A Div


jmcgriff60

Recommended Posts

I have been beating my head trying to figure out how to do this. I have a navigation div 125px wide on the left side of the page, then a main div to its right with CSS text-align:center applied to it. This works fine for single line paragraphs (title, contact info, and so on), but then I have a paragraph of text that I would like to be about 60% of the width of the div and either text-align:left or text-align:justify. (I prefer justify).I can do this easily using a table (I know, stay away from the table for layout :) ), or with a fixed left margin that pushes the block to the center. But I would like a more general way to center the justified text, which would allow for different widths and not require specific calculations.Is there a good way to do this?Thanks.

Link to comment
Share on other sites

something like this?<p style="text-align:justify; margin: 0 auto; width: 60%;">Center me please, Center me please, Center me please, Center me please, Center me please, Center me please, Center me please, Center me please, Center me please, </p>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...