|
Back to HTMLhtml Lesson 2

Text Formatting

Master headings, paragraphs, and text styles.

Headings

HTML offers six levels of section headings, `<h1>` is the highest (most important) and `<h6>` is the lowest.

html
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
...
<h6>Heading 6</h6>

Try it yourself:

HTML
CSS
Result

Paragraphs

The `<p>` tag defines a paragraph. Browsers automatically add a single blank line before and after each `<p>` element.

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

Try it yourself:

HTML
CSS
Result

Emphasis and Importance

Use `<strong>` for important text (usually bold) and `<em>` for emphasized text (usually italic).

html
<p>This is <strong>important</strong> text.</p>
<p>This is <em>emphasized</em> text.</p>

Try it yourself:

HTML
CSS
Result