I have always used either a <br />
or a <div/>
tag when something more advanced was necessary.
Is use of the <p/>
tag still encouraged?
The <p> tag defines a paragraph. Browsers automatically add a single blank line before and after each <p> element. Tip: Use CSS to style paragraphs.
It defines a paragraph of text. The end of the paragraph is marked by a closing </p> tag. Technically this is optional, but it's good practice to include the closing tag to ensure your document validates. By default, most browsers place a line break and a blank line between paragraphs.
The p tag denotes a paragraph element. It has margins/padding applied to it. A span is an unstyled inline tag. An important difference is that p is a block element when span is inline, meaning that <p>Hi</p><p>There</p> would appear on different lines when <span>Hi</span><span>There</span> winds up side by side.
P-end-tag (</p>) is not needed in HTML [closed]
Modern HTML semantics are:
<p></p>
to contain a paragraph of text in a document.<br />
to indicate a line break inside a paragraph (i.e. a new line without the paragraph block margins or padding).<div></div>
to contain a piece of application UI that happens to have block layout.Don't use <div />
or <p />
on their own. Those tags are meant to contain content. They appear to work as paragraph breaks only because when the browser sees them, and it "helpfully" closes the current block tag before opening the empty one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With