Click to See Complete Forum and Search --> : when you want extra space between <p>


CarlsDad
02-25-2006, 11:13 AM
Since I have my P margins set to 0 to avoid the extra spacing of paragraphs, I am looking for the best approach to put that extra spacing between Paragraphs when it is desired. I am torn between the 2nd and 3rd option.

Any suggestions?

-----------------------
<p> My text </p>
<p>&nbsp;</p>
<p> More text </p>

---------------------------
<p> My text </p>
<br />
<p> More text </p>

-------------------------
<p> My text </p>
<p style="margin-top:20px"> More text </p>

drhowarddrfine
02-25-2006, 01:25 PM
The third option is the one true way. Don't even think about the first one.

If you want to single out only certain <p>s, give them a class

<p class="bigger">somestuff</p>

.bigger {margin-top:20px}

Or, to single out one <p>, give it an id.

<p id="bigger">somestuff</p>

#bigger {margin-top:20px}

Kravvitz
02-25-2006, 01:27 PM
None of the above.

Use a class. (http://www.w3.org/TR/REC-CSS2/selector.html#class-html)

When should I use a class and when should I use an ID? (http://css-discuss.incutio.com/?page=ClassesVsIds)

Edit: drhowarddrfine beat me to it.