01. Basic Text Components <hn>, <p>, <strong>, <em>

There are quite a number of ways to specify text in HTML. In this section, we'll go over the most commonly used tags.


At the start of each text section, there should be a heading. In HTML, there are six heading levels, each with their respective closing tags: <h1>, <h2>, <h3>, <h4>, <h5>, <h6>

<h1> is the top level heading, and should be used only once per page. The major topic goes to <h1>, and a subtopic to <h2>, and so on.

Tips for writing a good heading

  • Headers should be based on content hierarchy.
  • Don't pay attention to the size of the headings! We can change that later through CSS.
  • Don't skip headers! Headings should go in order.
  • Don't use headings to markup a subtitle!
  • Make sure to use headings correctly, as they play a role in search ranking!


Following each heading, there should be some block of text. Usually this means a paragraph.

To specify a paragraph, we use the <p> tag. Each paragraph tag should group sentences together that share some context.

 <p>The platypus is a semiaquatic egg-laying mammal endemic to eastern Australia. It is one of the five extant species of monotremes, the only mammals that lay eggs instead of giving birth. It is the sole living representative of its family (Ornithorhynchidae) and genus (Ornithoryhynchus).</p>

Placing emphasis on text

To indicate that some text should be semantically emphasized, use the <em> and <strong> tags.

The difference between the two tags is that <em> indicates emphasis, while <strong> indicates stronger emphasis.

strong and em vs. b and i

If you play around with the strong/em tags, you'll see that by default they italicize and bold the font. But then you'll come to realize that are the <b> and <i> tags that also perform the same function.

So what's the difference here? Remember that HTML is about semantics, so the span and em should be used to emphasize the meaning of some text. <b> and <i> should rarely be used, as styling should be separate from markup.

Build modern and responsive webpages

The Modern Web

Build modern and responsive webpages Try Front-end

The Modern Web will guide you through the most important tools of device-agnostic web development, including HTML5, CSS3, and JavaScript. The plain-english explanations and practical examples emphasize the techniques, principles, and practices that you'll need to easily transcend individual browser quirks and stay relevant as these technologies are updated.

$ Check price
34.9534.95Amazon 4.5 logo(30+ reviews)

More Front-end resources

Aching back from coding all day?

Inversion Therapy Table

Aching back from coding all day? Try Back Problems

Stretch out your back and relieve your back muscles with inversion therapy. This device counteracts the forces of gravity on the body by decompressing and elongating the spine. By using this product just ten minutes a day, you can be well on your way to improved circulation and posture while relieving muscle aches, back pain and stress.

$$ Check price
119.98119.98Amazon 4.5 logo(1,700+ reviews)

More Back Problems resources