Hi! I'm trying to figure out how to write this code, and I just can't figure it out. What I want is to put my text into a "div", and I want the "div" centered. However, I want my text to align to the left. I know how to do this in a table, but I'm trying to learn not to use tables.
Example: If I'm writing this paragraph. I'd like it to be inside a div that's centered, but I'd like my text aligned to the left. How would I write this, please? I'm totally lost right now.
Thanks so much for the help! Sorry...I'm really, really new to css - it's still really scary to me right now!
Charlotte
Presumably the div element
Presumably the div element has an explicit width smaller than its container. otherwise the div, being a block element, will take all available width. An example:
<div id="box"> <div id="contentbox"> <p>Now is the time for all good men to come to the aid of their party.</p> <p>The quick brown fox jumps over the lazy dog.</p> </div> </div> ============ #contentbox { border: 1px dotted gray; margin: 0 auto; width: 50%; }
cheers,
gary