DEV Community

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

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

Mustapha Aouas on September 16, 2024

TLDR; The b and i tags are from HTML's past, focusing on appearance. The strong and em tags represent HTML's present and future, focus...
Collapse
 
best_codes profile image
Best Codes

Nice article. :) Very informative.

Collapse
 
wizard798 profile image
Wizard

Thanks for sharing this, I had same questions

Collapse
 
nifty-little-me profile image
It's Just Nifty

What a great explanation!

Collapse
 
mustapha profile image
Mustapha Aouas

Thank you!

Collapse
 
ansara_costa profile image
Ansara Costa • Edited

Excelente. Nos cursos do Brasil os professores mostram as Tags "strong" e "em" mas não explicam corretamente o motivo de haver Tags parecidas. Realmente os conteúdos de tecnologia em Inglês é muito superior e melhor que os conteúdos em português. Obrigada pela explicação.

Collapse
 
anna_lapushner profile image
anna lapushner

This is really useful. It love best practices knowledge gain. Thank you!

Collapse
 
mustapha profile image
Mustapha Aouas

Thank you ! Glad to hear that

Collapse
 
komsenapati profile image
K Om Senapati

Informative. I didn't know the differences between them.

Collapse
 
j9t profile image
Jens Oliver Meiert • Edited

The b and i elements did get an updated meaning with what was called “HTML 5,” which is now the HTML living standard. The HTML spec explains the meanings of all elements and provides examples, including b and i.

The four elements are distinct and can be used (preferably according to their purpose).

There has been lots of confusion around these elements—therefore good to discuss them!—, but they do have a place.

Collapse
 
laerciosant0s profile image
Laércio Santos

Underrated information. Thanks for it!

Collapse
 
efpage profile image
Eckehard

For a truely modern formatting, these tags are just small drops on a very hot stone. So we could also ask, why the very few tags the history of HTML provided for formatting should be used at all, while 99% of the formatting is done in CSS.

Collapse
 
donjuantriumphant profile image
Billy Johnson

The article did say 1990's and some websites and search engines STILL use these today ... not everything is an app just yet.

*looking at you Japanese websites!!

Collapse
 
efpage profile image
Eckehard • Edited

Even writing on stone plates is not totally uncommon today...

IE

Collapse
 
comandeer profile image
Tomasz Jakut

b and i are about appearance. They tell the browser, "Make this text bold" or "Make this text italic."

That's no longer true. These elements were updated in HTML5 and are described in the spec.

The b element:

The b element represents a span of text to which attention is being drawn for utilitarian purposes without conveying any extra importance and with no implication of an alternate voice or mood, such as key words in a document abstract, product names in a review, actionable words in interactive text-driven software, or an article lede.

The i element:

The i element represents a span of text in an alternate voice or mood, or otherwise offset from the normal prose in a manner indicating a different quality of text, such as a taxonomic designation, a technical term, an idiomatic phrase from another language, transliteration, a thought, or a ship name in Western texts.

In fact, I would argue that the i element has far more use cases than the em element. The latter is used only for stress emphasis:

The em element represents stress emphasis of its contents.

Your example showing usage of these elements is in-pair with what the specification says:

  1. You used strong to mark up the most important part of the text (the date of the debut).
  2. You used em to correctly put stress emphasis the word "early".
  3. You used b to bring attention to the "Note" word without marking it as more important than the rest of the content.
  4. You used i to mark up a scientific term.

Due to that, I'm quite confused because the example contradicts what you said about these elements.

Collapse
 
aralroca profile image
Aral Roca

Thanks for the article, I didn't know the difference. I have to say that for me semantically I understand better that b is from bold and i from italic and I like that they are less bytes, but it is also the habit of years and years using them, if I started today I would find it much better strong than b, although "em" to me is more confusing to relate it to italic than i...

Collapse
 
moopet profile image
Ben Sinclair

Imagine having a paragraph quote, which is styled to be entirely italicised.

Inside that quote, you want to have a word or phrase emphasised, like the name of a book for example. With <i>, you're limited to turning italics on.

If you then use CSS to say that, for example,

blockquote {
  font-style: italic;
}

blockquote i {
  font-style: normal; 
}
Enter fullscreen mode Exit fullscreen mode

then it's pretty confusing to read. There's literally a rule saying, "make italic text not italic". If you take the visual wording away, then it's easier to read because there's no contradiction.

Collapse
 
aralroca profile image
Aral Roca

Got it! Good point

Collapse
 
j9t profile image
Jens Oliver Meiert

The “b” and “i” elements did get an updated meaning with what was called “HTML 5.” (The HTML spec clarifies on the meanings and gives examples.)

The four elements are distinct and can be used (preferably according to their purpose).

Collapse
 
j9t profile image
Jens Oliver Meiert

The “b” and “i” elements did get an updated meaning with what was called “HTML 5.” (The HTML spec clarifies on the meanings and gives examples.)

The four elements are distinct and can be used (preferably according to their purpose).

Collapse
 
yunesh_shrestha_92d55c598 profile image
Yunesh Shrestha

Great

Collapse
 
jangelodev profile image
João Angelo

Hi Mustapha Aouas,
Top, very nice and helpful !
Thanks for sharing.

Collapse
 
kennedyjr10 profile image
Joel Orobor

Nice article, thanks for sharing.