SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 28
  1. #1
    SitePoint Member
    Join Date
    Oct 2006
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can em and strong be used in other things than sentences?

    Can em and strong be used in other things than in sentences? Like in lonely words in tables and so.

    Thank much!

  2. #2
    SitePoint Zealot Wynnefield's Avatar
    Join Date
    Sep 2005
    Location
    North Texas
    Posts
    137
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Should be able to apply these attributes to text content just about any place.

  3. #3
    Non-Member deathshadow's Avatar
    Join Date
    Jul 2006
    Location
    Dublin, NH
    Posts
    901
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,220
    Mentioned
    58 Post(s)
    Tagged
    3 Thread(s)
    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?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  5. #5
    SitePoint Member
    Join Date
    Oct 2006
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by r937
    how appropriate is emphasis or strong emphasis if the word is all by its widdle self?

    what means you?
    --Za 71 sekund hotovo!

  6. #6
    SitePoint Wizard bronze trophy Tyssen's Avatar
    Join Date
    Oct 2005
    Location
    Brisbane, QLD
    Posts
    4,067
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  7. #7
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,220
    Mentioned
    58 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by Tyssen
    ... you're better using a span and styling it with CSS.
    or use I or B as i suggested

    SPAN is such a wussy tag

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  8. #8
    SitePoint Wizard bronze trophy Tyssen's Avatar
    Join Date
    Oct 2005
    Location
    Brisbane, QLD
    Posts
    4,067
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  9. #9
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,220
    Mentioned
    58 Post(s)
    Tagged
    3 Thread(s)
    actually, latin words and book titles should be marked up with CITE

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  10. #10
    SitePoint Wizard bronze trophy Tyssen's Avatar
    Join Date
    Oct 2005
    Location
    Brisbane, QLD
    Posts
    4,067
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  11. #11
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  12. #12
    SitePoint Wizard bronze trophy DaveWoods's Avatar
    Join Date
    Dec 2004
    Location
    Derbyshire - UK
    Posts
    2,651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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?

  13. #13
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.
    Birnam wood is come to Dunsinane

  14. #14
    SitePoint Evangelist Ed Seedhouse's Avatar
    Join Date
    Aug 2006
    Location
    Victoria, B.C. Canada
    Posts
    592
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Tyssen
    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.
    Ed Seedhouse

  15. #15
    SitePoint Wizard bronze trophy DaveWoods's Avatar
    Join Date
    Dec 2004
    Location
    Derbyshire - UK
    Posts
    2,651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  16. #16
    I am obstructing justice. bronze trophy fatnewt's Avatar
    Join Date
    Jul 2002
    Location
    Ottawa, Canada
    Posts
    1,766
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by csswiz
    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>).
    Colin Temple [twitter: @cailean]
    Web Analyst at Napkyn


  17. #17
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by fatnewt
    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:
    HTML Code:
    <p>When you're writing something like <span lang="fr">raison d'etre</span> or ...</p>
    CSS:
    Code:
    span:lang(fr) { font-style: italic; }
    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.

  18. #18
    SitePoint Evangelist Ed Seedhouse's Avatar
    Join Date
    Aug 2006
    Location
    Victoria, B.C. Canada
    Posts
    592
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by csswiz
    Wouldn't <strong> represent bold and <em> represent italic though if that's how it appeared in the original text?.
    No. There is no requirement in html that <strong> use bold text and <em> use italics. There is for <b> and <i>.
    Ed Seedhouse

  19. #19
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by csswiz
    Wouldn't <strong> represent bold and <em> represent italic though if that's how it appeared in the original text?
    No! STRONG does not imply boldfacing and EM does not imply italics. They denote emphasis.

    Using STRONG/EM for bold/italics is every bit as bad as using B/I for emphasis.

    Quote Originally Posted by csswiz
    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.
    If you prefer this,
    HTML Code:
    <span class="foreign" lang="fr">je ne sais quoi</span>
    Code:
    .foreign {font-style:italic}
    over
    HTML Code:
    <i lang="fr">je ne sais quoi</i>
    it's up to you. Personally, I'd use <i>.
    Birnam wood is come to Dunsinane

  20. #20
    SitePoint Wizard bronze trophy DaveWoods's Avatar
    Join Date
    Dec 2004
    Location
    Derbyshire - UK
    Posts
    2,651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  21. #21
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  22. #22
    SitePoint Wizard bronze trophy DaveWoods's Avatar
    Join Date
    Dec 2004
    Location
    Derbyshire - UK
    Posts
    2,651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  23. #23
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by csswiz
    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.

    Quote 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.

    Quote 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.
    Birnam wood is come to Dunsinane

  24. #24
    SitePoint Wizard silver trophybronze trophy Stormrider's Avatar
    Join Date
    Sep 2006
    Location
    Nottingham, UK
    Posts
    3,133
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    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...

  25. #25
    I am obstructing justice. bronze trophy fatnewt's Avatar
    Join Date
    Jul 2002
    Location
    Ottawa, Canada
    Posts
    1,766
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would generally recommend having the CSS:

    Code:
    td { font-weight: bold; }
    Rather than using:

    Code:
    <td><b>Text</b></td>
    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).
    Colin Temple [twitter: @cailean]
    Web Analyst at Napkyn



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •