HTML Basics

HTML Paragraphs

Paragraphs are the foundation of text content on any webpage.
In HTML, the <p> tag is used to define a paragraph - separating blocks of text and improving readability for both users and browsers.

What Is an HTML Paragraph?

An HTML paragraph is created using the <p> element.
Browsers automatically add space before and after each paragraph to make text easier to read.

Paragraph Example

html

<p>This is my first paragraph.</p>
<p>This is another paragraph with more text.</p>

Each paragraph is treated as a separate block of content.

How Browsers Handle Paragraphs

  • Browsers ignore extra spaces or line breaks inside a paragraph.
  • Even if you press Enter or add multiple spaces, HTML will display them as a single space.

Example

html

<p>This
is     one
paragraph.</p>

Output

This is one paragraph.

πŸ’‘ To create actual line breaks, use the
tag (explained later).

Paragraph Styling with CSS

Example

html

<p style="color: #29AB87; font-size: 18px; line-height: 1.6;">
HTML paragraphs make your text organized and easy to read.
</p>

Common properties to style paragraphs:

  • color - text color
  • font-size - size of text
  • line-height - spacing between lines
  • text-align - alignment (left, center, right, justify)

Aligning Text in Paragraphs

Example

html

<p style="text-align:center;">This paragraph is centered.</p>
<p style="text-align:right;">This paragraph is aligned to the right.</p>
<p style="text-align:justify;">This paragraph is justified like in newspapers.</p>

Alignment improves presentation and helps with layout design.

Nested Elements Inside Paragraphs

You can include inline elements (formatting tag) such as <b>, <i>, <strong>, <em>, or <a> inside paragraphs.

Example

html

<p>HTML <strong>paragraphs</strong> can include <em>formatted text</em> and <a href="#">links</a>.</p>

Things to Remember

  • Paragraphs cannot contain block-level elements (like <div> or <h1>).
  • Always close the paragraph tag (</p>).
  • Avoid leaving empty <p></p> tags - they create unwanted space.

Browser Support

Chrome
Edge
Firefox
Safari
Opera
IE9+
YesYesYesYesYesYes

Conclusion

HTML paragraphs structure your text and make your web content clean, readable, and accessible.
Use them properly to separate ideas, add spacing, and create a natural reading flow for visitors.