Death to B and I

Wednesday, September 26, 2007

In the first of what I am sure will be many posts regarding HTML, I would like to bid farewell to my old friends <B> and <I>.

You may find them in various places on my current web sites, but from now on they will just be elements that I once ran with. The reason is that they hold no semantic value, and they really are just elements for styling the data. The web is comprised of three legs: HTML, CSS, and JavaScript. (I really need a graphic for that… maybe I’ll work on that as well.) These three legs nicely separate data, style, and function. There really shouldn’t be any mixing of rights between them.

Some people may think that the proper usage is to replace <B> with <strong> and <I> with <em>. In most cases that is correct, but not for the reason they are thinking. Although many browsers default to displaying <strong> as bold text, the reason to use <strong> over <B> is that semantically you are marking that bit of data as important. The same is true with <em>, you are trying to emphasize that bit of data so you surround it with the <em> element.

You should not rely on the browser’s default for styling these two elements. Proper use of CSS will ensure that these two tags appear the way you want them to, but that is a CSS discussion. Remember, HTML should only contain data. HTML is not the place for style or functionality.

HTMLhtml

This work is licensed under CC BY-NC-SA 4.0

The Little BR that Should Not

Paper Sometimes Wins