The Article

Using i and b Elements Again

This idea started from a tweet a while back about the difference between i, b, and span semantically speaking. When coding certain content, why not write something shorter for styles? I know it is taught to never use b or i anymore, but I felt like giving it a shot.

An Example

On one of the personal projects, I have a form that uses asterisks to represent which inputs are mandatory. As I was coding it up, I started questioning what the difference between using a span with a class, or just a simple i. Both elements do not describe its containing data, so I kept my markup a tad smaller:

1
<span class="req">*</span>

vs.

1
<i>*</i>

Using the i element for this type of content doesn’t make a difference in my opinion. The advantage to doing this, is writing a little less markup.

What W3C thinks

W3C’s definition of a span is “a generic wrapper for phrasing content that by itself does not represent anything.” In my opinion, this is exactly what is and bs are as well. They are only used for presentational purposes, in which we all overwrite in our CSS. Towards the bottom of this article, it seems as if the W3C thinks this as well, but also recommends adding a class to describe the containing content. They also remind us that we should always use an appropriate element when possible.

HTML5

The HTML5 spec, that is still being developed, explains that is and bs will have meaning.

i:

The i element represents a span of text in an alternate voice or mood, or otherwise offset from the normal prose, such as a taxonomic designation, a technical term, an idiomatic phrase from another language, a thought, a ship name, or some other prose whose typical typographic presentation is italicized.

b:

The b element represents a span of text to be stylistically offset from the normal prose without conveying any extra importance, such as key words in a document abstract, product names in a review, or other spans of text whose typical typographic presentation is boldened.

W3C Text-level semantics” by the W3C

Stick with Tradition

I think it is better to continue using a span element with a class. It will help when transitioning to HTML5 in the future and continue to be semantically correct in older doctypes as well.

There are 1 comment on “Using i and b Elements AgainLeave one yourself
  1. #1 Steven Dyson

    posted on Sep 24th 4:11 pm

    I still use ‘i’ and ‘b’ simply because its less code, but i also use span as basically a font coloring tool or a way to make something standout as a whole like all * on a page being red.

    I like web standards but most blokes use dreamweaver and frontpage any way. They suck at life Notepad++ for the win!

    Search Engine Optimization Central Florida

Leave a comment

My name is , my email address is ,

and my website address is .

My response:

(Some HTML is allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight=""> )