HTML Introduction | HTML Text Elements | Paragraphs

Paragraph <p>

The content placed between the <p> and </p> tags forms one paragraph.

Example

<p>This is a paragraph.</p>
<p>This is another paragraph.</p>

Run code

align attribute values

Attribute value Description
default A paragraph with no alignment is left-aligned by default.
left Left alignment. Since paragraphs are left-aligned by default if no alignment is specified, this is not used often.
center Center alignment.
right Right alignment.
justify Justified alignment. When a paragraph becomes long and wraps automatically at the edge of the screen, this aligns the edge evenly. At first glance it looks similar to left alignment, the default alignment, but you can see the difference by comparing the right edge where line wrapping occurs.

A small margin is automatically inserted above and below the <p> tag.

Displaying formatting as-is <pre>

To display text formatting written in HTML exactly as it is, use the <pre> tag, or preformatted text. All spaces and line breaks written inside the <pre> tag are displayed as-is in the web browser.

Example

<pre>
Azalea Flowers

When you leave,
weary of seeing me,
I shall let you go quietly, without a word.

From Yak Mountain in Yeongbyeon,
azalea flowers,
I shall gather an armful and scatter them on your path.
</pre>

Run code

Line breaks <br>

In HTML, you can create line breaks by using the <br> tag, or Line Breaks.

Example

<p>This paragraph <br>contains<br>line breaks.</p>

Run code

Horizontal rule <hr>

Use a horizontal rule when dividing paragraphs or expressing a separation in content. In HTML code, this kind of horizontal rule can be created simply with the <hr> tag, or horizontal rule.

Example

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

Run code