Strong emphasis on bold and italic Dec30 '04
If text needs to be bold AND italic, I would rather do this:
- XHTML
- I wish it was summer, and baseball was on
<span class="bold italic">every day!</span> - CSS
.bold {
font-weight: bold;
}
.italic {
font-style: italic;
}
... than to apply a class to a <strong> or <em> element:
- XHTML
- I wish it was summer, and baseball was on
<em class="bold">every day!</em> - CSS
.bold {
font-weight: bold;
}- XHTML
- I wish it was summer, and baseball was on
<strong class="italic">every day!</strong> - CSS
.italic {
font-style: italic;
}
My question is... Is "semantic" value lost by applying a class – rather than using phrase elements?
I don’t see the value in applying a class to a phrase element, such as <strong>, or <em>.
The experts
First off, the W3C states this:
Phrase elements add structural information to text fragments. The usual meanings of phrase elements are the following:
<em>indicates emphasis.
<strong>indicates stronger emphasis.
Stronger emphasis. That means that both <strong> and <em> elements indicate a different degree of emphasis. So... that being said, you should never have a situation where you need text to be both BOLD AND ITALIC – unless it’s for purely presentational purposes.
And if it’s for purely presentational purposes, the method I used above, should be acceptable.
A piece of text can’t be TWO different degrees of emphasis, at the same time. It’s either one or the other.
More to come on this...
Categories: CSS
, Semantics
, XHTML ![]()
Add Feedback (view all)
Leave feedback
Sadish, if it is purely for display purposes, I would NOT use <b> or <i>. I would use CSS, like you're supposed to. <b& ... Read more.
you are right on that too... the main idea I wanted to convey is, 'strong' and 'em' are has more meanings to themselves instead of just visu ... Read more.
matthom
is published and produced by Matt Thommes - an independent publishing enthusiast, mobile blogger, content creator, informative writer, web developer from a suburb of Chicago.
Never one to conform, Matt intends to promote the effect the web has on our lives, in an effort to intensify, instruct, and clarify all that is happening around us.
Popular Pages
- Fast rounded corners in Photoshop (4153 recent visits)
- PHP – passing variables across pages (1559 recent visits)
- JavaScript set selected on load (1290 recent visits)
- Removing all child nodes from an element (882 recent visits)
- iPod songs out of order? (747 recent visits)
- Britney - Everytime piano tab (669 recent visits)
- Firefox 3 smart address bar: wildcard search (633 recent visits)
- MySQL LEFT JOIN syntax (543 recent visits)
- Breathe Me - Sia (508 recent visits)
- Tumblr: how blogging should be (404 recent visits)
Similar Entries
- Bulls finish season <strong> (0 recent visits)
Stats
0 unique visits since Dec30 '04
if it is purely for display purposes, you would have used < b > < i > something < / i > < / b > but < strong > and < em > are different . ... Read more.