A paragraph in HTML is created with the <p> tag. It's a block-level
element, meaning it takes up the full width available and always starts on a new line.
Think of it as the introvert of HTML—it needs its personal space.
<p>This is a paragraph. It contains text.</p>
<p>This is another paragraph. Notice the spacing.</p>
<p>Paragraphs prevent your content from becoming an overwhelming wall of text that nobody wants to read.</p>
Browsers automatically add vertical spacing (margins) before and after each paragraph. This isn't magic—it's default CSS that every browser applies. The exact spacing varies slightly between browsers, but they all agree that paragraphs deserve breathing room.
Block vs Inline Elements
Block elements like <p> create new lines and stretch to fill
available width. Inline elements like <span> or
<strong> flow within text without breaking lines. You can put
inline elements inside paragraphs, but never nest one paragraph inside
another—HTML will close the first paragraph automatically and rearrange your
markup like a judgmental interior designer.
Whitespace Collapsing
HTML collapses multiple spaces, tabs, and line breaks into a single space. You can press Enter forty times in your code—the browser will render it as one space. This behavior keeps layouts consistent regardless of how messy your source code is.
Default Styling
Every browser applies a user agent stylesheet with default paragraph margins (typically 1em top and bottom). You can override these with your own CSS, but the defaults exist to make unstyled HTML at least somewhat readable.
Semantic Meaning
Using <p> tells browsers, search engines, and assistive
technologies "this is a paragraph of text." This semantic meaning helps
screen readers navigate content and gives search engines context about your
content structure.
<p>
This has excessive spacing
and multiple line breaks
but displays as one continuous line with normal spacing.
</p>
If you actually need to preserve formatting with spaces and line breaks intact, use the
<pre> (preformatted) tag instead. It's specifically designed for code
snippets, ASCII art, or any content where spacing matters.
The Empty Paragraph Crime
Never use empty <p></p> tags to create vertical space.
It's semantically wrong, creates confusion for screen readers (they'll announce
empty paragraphs), and CSS exists specifically to handle spacing. Use margins or
padding instead. This is one of those things that might work but will haunt you
later.