Can em and strong be used in other things than in sentences? Like in lonely words in tables and so.
Thank much!
| SitePoint Sponsor |
Can em and strong be used in other things than in sentences? Like in lonely words in tables and so.
Thank much!

Should be able to apply these attributes to text content just about any place.
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.


lonely words in tables and so? perhaps I or B would be a better choice
how appropriate is emphasis or strong emphasis if the word is all by its widdle self?
Originally Posted by r937
what means you?
--Za 71 sekund hotovo!
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.


or use I or B as i suggestedOriginally Posted by Tyssen
SPAN is such a wussy tag
![]()
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.


actually, latin words and book titles should be marked up with CITE
![]()
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.
Birnam wood is come to Dunsinane
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:
Of course you could use <span class="ship"> or <span class="foreign">, but <i> is much shorter and neither is more semantic than the other.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>
Birnam wood is come to Dunsinane



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.Originally Posted by Tyssen
Ed Seedhouse
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.Originally Posted by csswiz
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:Originally Posted by fatnewt
CSS:HTML Code:<p>When you're writing something like <span lang="fr">raison d'etre</span> or ...</p>
Of course, you'll have to wait for IE support on that one and you might want to use a more meaningful tag than span if it suits your purposes.Code:span:lang(fr) { font-style: italic; }



No. There is no requirement in html that <strong> use bold text and <em> use italics. There is for <b> and <i>.Originally Posted by csswiz
Ed Seedhouse


No! STRONG does not imply boldfacing and EM does not imply italics. They denote emphasis.Originally Posted by csswiz
Using STRONG/EM for bold/italics is every bit as bad as using B/I for emphasis.
If you prefer this,Originally Posted by csswiz
HTML Code:<span class="foreign" lang="fr">je ne sais quoi</span>overCode:.foreign {font-style:italic}
it's up to you. Personally, I'd use <i>.HTML Code:<i lang="fr">je ne sais quoi</i>![]()
Birnam wood is come to Dunsinane
Thanks for clearing that up. I suppose it's in my mind set that anything that applies anything presentational in the code is bad but that obviously isn't the case.
It's probably come into my way of thinking from the days when <font color=red><i></i></font> was acceptable.
Like you say though Tommy it does make much more sense than to simply have an <i> in the page itself than to try and achieve this through CSS so thanks for correcting the error of my ways![]()


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.![]()
Birnam wood is come to Dunsinane
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![]()


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 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.Originally Posted by csswiz
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.
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.Originally Posted by csswiz
Birnam wood is come to Dunsinane

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...
I would generally recommend having the CSS:
Rather than using:Code:td { font-weight: bold; }
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).Code:<td><b>Text</b></td>
Bookmarks