HTML Paragraphs
HTML paragraphs are used to group and display blocks of text.
They help keep content readable and well-structured.
The <p> Element
The <p> tag defines a paragraph.
<p>This is a paragraph of text.</p>
- Browsers automatically add space before and after a paragraph
- Extra spaces and line breaks inside the tag are ignored
Paragraph with Attributes
The <p> element supports global attributes.
<p
id="intro"
class="text-block"
title="Introduction paragraph">
HTML paragraphs organize written content on a page.
</p>
Attributes Used
id→ unique identifierclass→ grouping or stylingtitle→ tooltip text
Line Breaks Inside Paragraphs
To move text to a new line without starting a new paragraph, use <br>.
<p>
HTML is easy to learn.<br>
Practice makes it better.
</p>
Paragraph with Inline Elements
Paragraphs often contain inline elements.
<p>
HTML is <strong>simple</strong> and
<em>easy to understand</em>.
</p>
Empty Spaces in Paragraphs
HTML ignores:
- Extra spaces
- Multiple line breaks
- Tabs
Example:
<p>
This text has
extra spaces.
</p>
Browser displays it as normal text.
Important Notes
- Always wrap text inside
<p>tags - Do not nest block elements inside
<p> - Use paragraphs for content, not layout