To take part in discussions on talkSFU, please apply for membership (SFU email id required).

Difference between and

edited May 2008 in General
What is the difference between the tags < i > and < em >?

I know < i > is physical markup and < em > is logical markup, but I tested both and they look the same. In what situation do I use one or the other?

Comments

  • edited May 2008
    You never use < i > it is outdated, thus not valid.
  • edited May 2008
    You should use < em > in general because it's "logical markup" like you said. This way, you can change what < em > looks like by changing the stylesheet. You could make < em > be underlined, bold, and coloured red if you wanted but it's italic by default.

    If you keep all the stylistic elements separate from your actual content, it's much easier to make style changes later.
  • edited May 2008
    Great, thanks for the info.
  • edited May 2008
    em stands for emphasis, it describes what the content means, not what it looks. There are plenty of other tags that are also italic, like < cite > (for citations). Just because they look the same doesn't mean you should use one all the time. You should use whatever has the best meaning.

    With that said, there's a slight flaw in the current XHTML specification in that it doesn't allow for i and b. It's understandable why they did that, to force people to use semantic markup (since everyone's so accustomed to using i for everything), but there are instances where < i > would in fact be semantically appropriate, rare instances, but they do exist.

    Of course, if this is for a class, you probably don't have to worry about anything beyond "use < em > for everything", even if it might not be totally correct usage.

Leave a Comment