HTML Paragraphs

What Is a Paragraph?

The <p> tag defines a paragraph of text. It’s one of the most common HTML elements used to display textual content in readable blocks.

Syntax

<p>This is a paragraph of text.</p>

Default Behavior

Browsers automatically insert spacing before and after each paragraph, making them visually distinct without extra styling.

Nesting Rules

You cannot place block elements like <div> or another <p> inside a paragraph. Paragraphs are meant for inline content like <span>, <strong>, or <a>.

Line Breaks vs Paragraphs

Use <br> to insert a single line break within a paragraph:

<p>This is line one.<br>This is line two.</p>

Use separate <p> tags for distinct blocks of text.

Styling Paragraphs

CSS can control the appearance of paragraph text:

p {
  color: #333;
  font-family: Verdana;
  line-height: 1.6;
  text-align: justify;
}

Semantic Meaning

Paragraphs represent meaningful units of language. Screen readers and search engines rely on them for interpreting natural structure and improving accessibility.

Practice Prompt

Write two paragraphs separated by a horizontal rule. Use <br> to add a line break inside one of them.

<p>This is the first paragraph.<br>It has two lines.</p>
<hr>
<p>This is the second paragraph.</p>

Need Help?

Ask the AI if you need help understanding or want to dive deeper in any topic