Questuin about <P>

liunx

Guest
I have this CSS code for paragraph (P).

p {
margin: 0px;
text-align: justify;
font: 12px;
color: #fff;
}

The thing is that if I have a few paragraphs so there's no space between'em. I want to have space between the paragraphs - how can I do it?

Thanks!Is it too obvious to say <br /> ?depends on how you want that space to look, but generally speaking that br tag will suffice.. lol :rolleyes:By specifying "margin: 0;" (you don't need "px" or any unit if value is 0), you've said you don't want any space anywhere around the P element. So, if you want 1em between paragraphs, you could do this (all space above P):

p {
margin: 1em 0 0 0;
text-align: justify;
font: 12px;
color: #fff;
}

...or this (equal space above and below P):

p {
margin: 0.5em 0;
text-align: justify;
font: 12px;
color: #fff;
}

...or this (all space below P):

p {
margin: 0 0 1em 0;
text-align: justify;
font: 12px;
color: #fff;
}


PS: Don't do the <br> thing - that's adding non-syntactic markup to create the visual style, which is against the intent and spirit of using CSS in the first place.I used the last one

p {
margin: 0 0 1em 0;
text-align: justify;
font: 12px;
color: #fff;
}


Thanks guys!I take the point about <br />. How about '<hr />' ? Is it bad practice to use that too?Originally posted by BonRouge
I take the point about <br />. How about '<hr />' ? Is it bad practice to use that too?

That's still very much in debate. There's a strong argument both for and against it.Yes, and the debate has already taken place. <http://www.webdeveloper.com/forum/showthread.php?threadid=40620#post222080>
 
Back
Top