S
Steve Richter
I can use margin: auto to center the text of a <p>. But only if I
specify the width of the <p>
<div style="border: #603 dotted; padding: 0.5em; margin: 1em 2em;">
<p style="margin:1em auto; width: 8em; text-align: left;">
Trying to center some text!. Width method.</p>
</div>
I cant get the <p> to center when I use width:auto, as in the width of
the <p> element is the width of its text:
<div style="border: #603 dotted; padding: 0.5em; margin: 1em 2em;">
<p style="margin: 1em auto; display:inline; text-align: left;">
Trying to center some text! display:inline;</p>
</div>
<div style="border: #603 dotted; padding: 0.5em; margin: 1em 2em;">
<p style="margin: 1em auto; display:block; text-align: left;">
Trying to center some text! display:block;</p>
</div>
Is centering without using width doable? CSS is very confusing!
thanks,
-Steve
specify the width of the <p>
<div style="border: #603 dotted; padding: 0.5em; margin: 1em 2em;">
<p style="margin:1em auto; width: 8em; text-align: left;">
Trying to center some text!. Width method.</p>
</div>
I cant get the <p> to center when I use width:auto, as in the width of
the <p> element is the width of its text:
<div style="border: #603 dotted; padding: 0.5em; margin: 1em 2em;">
<p style="margin: 1em auto; display:inline; text-align: left;">
Trying to center some text! display:inline;</p>
</div>
<div style="border: #603 dotted; padding: 0.5em; margin: 1em 2em;">
<p style="margin: 1em auto; display:block; text-align: left;">
Trying to center some text! display:block;</p>
</div>
Is centering without using width doable? CSS is very confusing!
thanks,
-Steve