jalmz — 2011-07-20T21:52:32-04:00 — #1
can we use this
<p><b>text</b> and <em>text</em></p>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
as a css style?
louie540 — 2011-07-20T22:59:29-04:00 — #2
I believe the <b> tag is obsolete in XHTML. Try <strong> instead.
system — 2011-07-20T23:55:57-04:00 — #3
@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.
louie540 — 2011-07-21T00:20:38-04:00 — #4
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.
system — 2011-07-21T01:30:47-04:00 — #5
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...
stevie_d — 2011-07-21T08:02:48-04:00 — #6
Lose the full stops there ... p.b refers to <p class="b">. What you need is just p b.