The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Honestly, they're just another inline element - so long as you don't use them to wrap block levels, you can pretty much use them where you like - JUST be wary of using extra tags when you could just style the parent container.

What he means is that em and strong are s'posed to indicate different types of emphasis on certain words when reading a sentence. They're not s'posed to be used to make things bold or italic. If you're just using them to affect their presentation, you're better using a span and styling it with CSS.

Using i or b to make words italic or bold is still using HTML for presentation which is the point I was making. I can't really think of a good example for using b but i could be used instead of em when marking up words that are s'posed to be italicised but not necessarily for emphasis, e.g. latin terms or titles of books, ships etc.

Not necessarily. Cite is used for citations and references. A book title can be used in a sentence without it being a reference, e.g.: "I read The Lord of the Rings yesterday." Latin terms also do not necessarily have to be citations, for instance in medical texts when referring to bacteria.

As long as you mean to emphasise a word or a phrase, EM (or possibly STRONG) is the right element type. It doesn't matter if it's a 'lone word in a table' or if it's within a paragraph of text.

@Rudy: Latin words in general should not be marked up with CITE, unless they constitute the title of a work that you are citing or quoting from. The same applies to book titles. CITE is for citations: references to sources that you have quoted or otherwise drawn from.

Why would you use <i> or <b> for anything? Aren't these tags deprecated now?

This would be using HTML for presentational purposes so unless this should be <strong> or <em> used in it's proper semantical sense then surely you should be apply any bold or italic through the use of css?

No, I and B are not deprecated. They can be used when you want to adhere to certain typographic conventions (like italicising ship names or phrases in foreign languages).

I and B should not be used for emphasis, though. That's what EM and STRONG are for. Most of the time you should use CSS to make things italic or boldfaced, but there are certain things that are italicised (and probably boldfaced, too, although I can't come up with any) by tradition.

A couple of examples:

HTML Code:

<p><i>Titanic</i> sank on its maiden voyage in 1912.</p><p>Semantics is my <i lang="fr">raison d'Ítre</i>.</p>

Of course you could use <span&#160;class="ship"> or <span&#160;class="foreign">, but <i> is much shorter and neither is more semantic than the other.

I can't really think of a good example for using b but i could be used instead of em when marking up words that are s'posed to be italicised but not necessarily for emphasis, e.g. latin terms or titles of books, ships etc.

I've seen it argued that when quoting original text, B and I are semantically meaningful when used to represent Bold and Italic fonts that actually appear in the original. The original presumably had a semantic purpose behind using such effects after all.

Wouldn't <strong> represent bold and <em> represent italic though if that's how it appeared in the original text?

Personally I avoid <b> and <i> now and if I need something bold or italic purely for presentational and visual purposes then I'll use CSS to achieve this.

Because <strong> and <em> have a semantic meaning.

When you're writing something like raison d'etre or Lord of the Flies, you're not actually emphasizing those words. They're not actually more important than the other words, but we use <i> to follow the typographical convention of italicising certain words.

Consider the following sentence:

We were extremely pleased with their translation of La Peste.

In this case, the word "extremely" should be marked up with the <em>, since it's actually emphasized in the sentence. "La Peste" is the name of a novel, so it is marked up with <i>. Speaking aloud, you would change your tone when saying "extremely" but not when saying "La Peste".

It doesn't actually matter whether you use <i> or CSS to style something in italics alone (without emphasis) -- both are presentational, and you need some extra HTML to do it either way (such as a <span>).

When you're writing something like raison d'etre or Lord of the Flies, you're not actually emphasizing those words. They're not actually more important than the other words, but we use <i> to follow the typographical convention of italicising certain words.

Consider the following sentence:

We were extremely pleased with their translation of La Peste.

In this case, the word "extremely" should be marked up with the <em>, since it's actually emphasized in the sentence. "La Peste" is the name of a novel, so it is marked up with <i>. Speaking aloud, you would change your tone when saying "extremely" but not when saying "La Peste".

It doesn't actually matter whether you use <i> or CSS to style something in italics alone (without emphasis) -- both are presentational, and you need some extra HTML to do it either way (such as a <span>).

Other languages can be styled up with CSS. To use your first sentence:

It's a question of somehow highlighting text without necessarily emphasise it. Using CSS is usually the way to go, but for some cases I think it's just as good – or better – to use <i> or <b>. That way you'll achieve the purpose of highlighting even in non-CSS browsers, like Lynx.

My recommendation is: don't be afraid of <i>, but think twice about it before you use it.

Yeah it's a tricky one of when to use it as obviously using <i> or <b> is adding something visual which does allow for non-css browsers to see it but then where does this stand with screenreaders?

If you are using the <b> tag, aren't you essentially emphasizing the word visually to a user and therefore wouldn't <strong> be a better use so that a visually blind user would also get the same experience?

Sorry, I hope this doesn't come across as argumentative... it's just something that I'd like to get my head around as English never was one of my strong points at school

Yeah it's a tricky one of when to use it as obviously using <i> or <b> is adding something visual which does allow for non-css browsers to see it but then where does this stand with screenreaders?

Screenreaders should ignore B and I. How do you pronounce bold text? Italics? It's a visual thing, but there are long-standing typographic conventions that you may wish to adhere to for usability reasons.

Originally Posted by csswiz

If you are using the <b> tag, aren't you essentially emphasizing the word visually to a user and therefore wouldn't <strong> be a better use so that a visually blind user would also get the same experience?

If it is a matter of emphasis, you should use EM (or possibly STRONG). If you would emphasise it if you were reading the page out loud to someone – raising your voice a bit, slowing down, enunciate each syllable more clearly – then you should use EM or STRONG.

But if you just want to make a ship's name italic (because that's been tradition for centuries), use I. You wouldn't emphasise the ship's name particularly when reading the text out loud. It's just a convention to use italics for ships' names.

Originally Posted by csswiz

Sorry, I hope this doesn't come across as argumentative...

Not at all. The distinction can be very difficult sometimes. I personally, when in doubt, try to imagine how I would read it out loud. If I would put vocal emphasis on a word or a phrase, then I'll mark it up with EM. If I would just like it italicised, I'll have to make another decision: is there a typographic convention to fall back on, then I use <i>; otherwise I'll use a class and style it with CSS.

I always thought B and I were deprecated as well - learn something new every day i guess!

On the orignal topic though - if this person has lone words in a table to style, wouldnt he be better off just using css on the table cell? No extra markup, no worrying about if you are using the right tag...

If the complete block element is to be affected, I'd apply it as a style (CSS) to the entire element. It's only when certain words are formatted in-line that <b> and <i> become useful, I think. In general, if you're adding extra markup, I'd use <b> or <i> ahead of a <span> with a style, for ease and compatability. But if you already have the entire formatted text in an element, it's probably better to use external styles rather than add unnecessary markup (especially if the formatting is repeated).