Why HTML has both <b / i> and <strong / em>?

Reading time

~ 3 min read
Tags

html
Author

Mustapha Aouas
Why HTML has both <b / i> and <strong / em>?

TLDR;


As a web developer, you might have noticed something puzzling. There seem to be two sets of tags that do very similar things:

  1. The b tag makes text bold, and the i tag makes it italic.
  2. The strong tag also makes text bold, and the em tag makes it italic.

So why does HTML have both? Aren't they doing the same job? Well, not exactly. Let's uncover the story behind these seemingly redundant pairs.

A Brief History Lesson

To understand why we have both sets of tags, we need to take a quick trip back in time. When HTML was first created in the early 1990s, it included the b and i tags. These tags were straightforward: b made text bold, and i made it italic. Simple, right?

But as the web evolved, developers and designers realised something important: HTML shouldn't just be about how things look. It should also be about what things mean.

Enter Semantic HTML

This realisation led to the concept of "semantic HTML”. The word "semantic" refers to the meaning of something. In the context of HTML, it means using tags that describe what the content is, not just how it looks.

This is where strong and em come in. These tags were introduced to give meaning to the text, not just change its appearance:

So, here's the big difference:

Why Does It Matters

You might be thinking, "Okay, but they still look the same on the page. Why should I care?”. Well, I see two main reasons why this distinction is important:

When to Use Which?

Let's look at an example to make this clearer:

The zoo's new panda, named Mei Lan, will make her
<strong>public debut next Tuesday, July 16</strong>.
Visitors are advised to arrive <em>early</em> as large
crowds are expected.

<b>Note:</b> Her favorite food is <i>bambusa vulgaris</i>,
a type of bamboo.

In this example:

The Bottom Line

While b/i and strong/em might look the same on a webpage, they serve different purposes.

As a general rule, it's best to use strong and em in your HTML. They provide more information about your content's meaning and can improve accessibility and search engine optimisation.

However, b and i still have their places for purely visual styling or in specific situations where you don't want to imply extra importance or emphasis. That said, for simple visual styling, you can use a span elements with CSS classes, as it offers more flexibility and maintains a clearer separation between content and presentation.

Good HTML isn't just about making pages look right — it's about making them mean right too.