SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: <b> <em> CSS

  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2011
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    <b> <em> CSS

    Hi guys,

    can we use this
    Code:
     <p><b>text</b> and <em>text</em></p>
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    as a css style?

    p.b {font-size:12px;}
    p.em {font-color:#000000;}

  2. #2
    SitePoint Zealot
    Join Date
    Apr 2011
    Location
    San Diego
    Posts
    111
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I believe the <b> tag is obsolete in XHTML. Try <strong> instead.

  3. #3
    Non-Member bronze trophy
    Join Date
    Nov 2009
    Location
    Keene, NH
    Posts
    3,760
    Mentioned
    23 Post(s)
    Tagged
    0 Thread(s)
    @louie540 -- no, no it isn't. B and I do not MEAN the same thing as STRONG and EM -- though a lot of people seem to think they do just because they have the same default appearance... They are NOT deprecated, and they sure as shine-ola aren't obsoleted in the specifications... Despite wild claims to the contrary.

    The default appearance has jack to do with what a tag MEANS -- as one of my old signatures said, if you're choosing tags because of what they look like, you're probably choosing the wrong tags.

    For the question at hand, it depends on what the content IS and WHY you are applying those tags to it.

    An example a friend of mine made a while back:

    <b><i>GURPS,</i></b> <b>Steve Jackson Games'</b> flagship role-playing game, was first released in 1985. Several licensed adaptations of other companies' games exist for the system, such as <b><i>GURPS Bunnies and Burrows.</i></b> However, <b>SJ Games</b> has no connection with <b>Wizards of the Coast</b>, producers of the <i>Dungeons and Dragons</i> RPG. <em>No <b><i>GURPS,</i></b> content is open-source.</em> <strong>Do not plagiarize <b>SJ Games</b> work!</strong>

    Which does a great job of showing the who/where/why of when to use B, I, STRONG and EM, and how they ALL still serve a semantic purpose. Strong and EM apply extra "emphasis" to the content around them -- it's why screen readers read them differently! B and I are hooks for when the grammatical presentation of text is different, without applying a specific semantic meaning -- it's one of the few times presentation in the markup should and does make any sense. You're not "adding emphasis" when it's a company or book title, so EM (emphasis) or STRONG (MORE emphasis) make no sense.

    Oh and if that's CONTENT like flow text in the main part of your document, declaring your fonts in PX is a miserable failure at accessibility.

  4. #4
    SitePoint Zealot
    Join Date
    Apr 2011
    Location
    San Diego
    Posts
    111
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Really?

    *Googles*

    Well I guess you're right. I don't know why I thought <b> was an old tag, like <center>. I think I remember hearing that it was, but I guess I was misinformed.

  5. #5
    Non-Member bronze trophy
    Join Date
    Nov 2009
    Location
    Keene, NH
    Posts
    3,760
    Mentioned
    23 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by louie540 View Post
    Well I guess you're right. I don't know why I thought <b> was an old tag, like <center>. I think I remember hearing that it was, but I guess I was misinformed.
    Well, it IS presentational... but grammatically so. A lot of people seem to have that notion in their heads about B and I... which is funny because it's never been true. But yeah, a LOT of people out there keep saying they're deprecated or even obsoleted -- and they aren't...

    I think a lot of it stems from the people who never embraced semantics, or just missed the point... Semantic markup isn't just about slapping tags with meanings around everything -- in many ways the content should speak for itself... slapping tags with meanings around the WRONG things is just as bad as using tags without meanings or just for presentation -- which is where tags that are 'semantically neutral' like B, I, SPAN, etc come into play. If there's a GRAMMATICAL reason for text to TYPICALLY be bold or italic, then there's nothing wrong with using B and I... in many cases it's better than using STRONG on things that, well... shouldn't be receiving more emphasis than the text around it. In fact, using it for grammatical purposes like a book title IS semantic -- and it's not like you HAVE to style bold as bold -- in fact that's the POINT of HTML. You're saying grammatically this text is bolded, like say a book title or name of a ship, that's semantic markup... and it's up to the user-agent (browser) or developer to best figure out how to communicate that in the context of the document.... and if that means the bold tag isn't actually showing in bold -- that's fine. Again, that's what HTML is FOR.

    But of course we have proof enough most people don't grasp semantics of the purpose of STRICT with the constant HTML 3.2 people vomit up and slap a 4 tranny or 5 lip-service onto... much less the 'allegedly' semantic HTML 5 tags that just turn something simple into a overcomplicated bloated mess.

    Because of course when nobody can figure out how to use the tags we already have properly, throwing more tags at it is SUCH a great solution...

  6. #6
    Mouse catcher silver trophy Stevie D's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    5,892
    Mentioned
    123 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by jalmz View Post
    Hi guys,

    can we use this
    Code:
     <p><b>text</b> and <em>text</em></p>
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    as a css style?

    p.b {font-size:12px;}
    p.em {font-color:#000000;}
    Lose the full stops there ... p.b refers to <p class="b">. What you need is just p b.


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
  •