HTML Paragraphs
The <p> tag defines a paragraph of text. Browsers automatically add space before and after each paragraph.
HTML collapses extra whitespace and line breaks in source code into a single space, so you cannot create visual line breaks just by pressing Enter in your code β you need the <br> tag or CSS instead.
<p>Text content</p>Whitespace collapsing
Multiple spaces, tabs, and newlines in your HTML source are all rendered as a single space by the browser. This keeps your source code flexible for formatting.
Line breaks
Use <br> to force a line break within a paragraph without starting a new one, useful for addresses or poems.
<p>This is a paragraph
with line breaks in the source.</p>This is a paragraph with line breaks in the source.Extra whitespace and newlines collapse into single spaces.
<p>123 Main St.<br>Springfield, USA</p>123 Main St.
Springfield, USA<br> forces a line break inside the same paragraph.
Key points
- <p> defines a paragraph with automatic spacing.
- Browsers collapse extra whitespace into one space.
- Use <br> for a forced line break.
- Don't use empty paragraphs just to add spacing β use CSS.
