I have always used either <br />
or a <div/>
tag when something more advanced is necessary.
Is use of the <p/>
tag still encouraged?
I have always used either <br />
or a <div/>
tag when something more advanced is necessary.
Is use of the <p/>
tag still encouraged?
Using
<p />
has never been encouraged:From XHTML HTML Compatibility Guidelines
A
<p>
signifies a paragraph. It should be used only to wrap a paragraph of text.It is more appropriate to use the
<p>
tag for this as opposed to<div>
, because this is semantically correct and expected for things such as screen readers, etc.From the HTML 4.01 Specification :
While they are syntactically correct, empty P elements serve no real purpose and should be avoided.
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..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.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/>....