Could you specify? You question reads that you already use <p></p> (paragraph) tags but when you need something more advanced you use <div> or <br /> (break) tags. What is an instance where you are told to use <p> instead of <div>?
–
Darren NewtonAug 11 '09 at 15:29

I've been told that im using <br /> when i should use <p /> instead.
–
maxpAug 11 '09 at 15:31

11 Answers
11

Use <br /> to indicate a line break inside a paragraph (i.e. a new line without the paragraph block margins or padding).

Use <div></div> to contain a piece of application UI that happens to have block layout.

Don't use <div /> or <p /> on its own, those tags are meant to contain content. They appear to work as paragraph breaks only because when the browser sees them, it "helpfully" closes the current block tag before opening the empty one.

A <p> tag wraps around something, unlike an <input/> tag, which is a singular item. Therefore, there isn't a reason to use a <p/> tag..

I've been told that im using <br /> when i should use <p /> instead. – maxp 49 secs ago

If you need to use <p> tags, I suggest wrapping the entire paragraph inside a <p> tag, which will give you a line break at the end of a paragraph. But I don't suggest just substituting something like <p/> for <br/>

<p> tags are for paragraphs and signifying the end of a paragraph. <br/> tags are for line breaks. If you need a new line then use a <br/> tag. If you need a new paragraph, then use a <p> tag.

That is a bad habit of mine. I tend to post really fast and then edit a lot in.
–
Tyler CarterAug 11 '09 at 15:38

6

Chacha102: Stackoverflow seems to encourage the answer real quick, then edit in details workflow, especially for questions which are going to get a lot of answers. Hard to be the "fastest gun in the west" when you're typing a detailed answer. This is, I think, rather unfortunate.
–
derobertAug 11 '09 at 15:42

Interestingly, Counting paragraph tags states that a random sample of 833,866 HTML documents found that 50.1% of the documents sampled contain only <p>...</p>, 4.41% contain only ...<p>..., and a mere 0.21% contain only ...<p/>....

For any practical purpose you dont need to add the </p> into your markup. But if there is string XHTML adheration requirement, then you would probably need to close all your markup tags, including <p>. Some XHTML analyzer would report this as an error.