Click to See Complete Forum and Search --> : To <b> or not to <b>


rooshk34
08-30-2007, 03:54 PM
I've been working on some documents, and was asked by my boss to put the formatting in the CSS. There are some specific spans that they want used.

I was wondering if it makes any sense (and if there is any advantage) to include spans for bold and italic text rather that just using the good ol' <strong> or <b> tags in the html. Any suggestions?

Mr Initial Man
08-30-2007, 04:02 PM
One I can think of right off: a special span for foreign languages, which are italicized, or if you're italicizing something for visual effect rather than emphasis. Otherwise, if you're emphasizing something, use <em>

Kravvitz
08-30-2007, 04:29 PM
It depends on each situation. You should use an <em> if you want to emphasize some text and <strong> if you want to give strong emphasis to some text.

Check out <em> <strong> or <i> <b> (http://www.sitepoint.com/forums/showthread.php?t=294327).

rooshk34
08-30-2007, 04:45 PM
So what I understand is that it's best to put the straight text formatting into the css. However, if I want to emphasize a word (not just format the text) in some way I should use a <strong> or <em> tag in the html. Did I understand correctly?

Mr Initial Man
08-30-2007, 05:02 PM
Exactly. That's semantics, i.e. the element should perform the function its name describes. <span> and <div> don't mean anything, so they can be used for anything.

CSS does formatting by working through HTML.

WebJoel
08-30-2007, 05:33 PM
"<b>", "<i>" and (example) "<font size=3>" are just a few of the non-semantic tags that I never use anymore. Whenever I update a client's page(s), I aggressively remove these deprecated tags in favor of semantic markup.