Previous Message
Next Message

Re: [css-d] Hello - new list member with beginner css questions

Sent by aardvark on 31 January 2002 10:10

> From: Rijk van Geijtenbeek [EMAIL-REMOVED]>
> <p>Some text with a <span style="color:red;">special</span> word in
> it.</p>
> Of course, this doesn't offer any advantage above the FONT tag.
> This is better:
> <p>Some text with a <span class="special">special</span> word in
> it.</p>
> ... and in your stylesheet:
> .special {color: red;}

neither of these really offers much advantage over the <font> tag... 
sure, you're now maintaining the color in one place, but believe it or 
not, you've just embedded style into your page anyway...

since the sole purpose of that <span> is to apply a style, it's as 
bad as having a <font> (IMO)...  what happens if you don't want it 
styled anymore?  do you cut all the <span> as if they were 
<font>s, or just unstyle the class in your CSS?

the point is, and not a lot of people completely agree with me on 
this, your markup should do two things:

- impart structure (like your <div>s in a CSS layout, or your <h#> 
tags do to imply hierarchy)

- impart syntactical/semantic meaning (like <em> and <strong> 
do, or better yet, <abbr>, <acronym>, <cite>, etc.)

just like we should use <strong> over <b> (b just bolds, strong 
implies the word is stronger, and now screen readers can deal with 
it, among other benefits), we should try to use only structural and 
semantic mark-up in pages...

yeah, this is long-winded, but it is all tied to the CSS...

is there an existing HTML element that would fit that word?  should 
it be emphasized (<em>) or stronger (<strong>) than the rest?  if 
so, try one of those tags and style that tag...

and if you need a custom look, then class it...

and now you aren't embedding <span> strictly for the purpose of 
styling your content...

and now your CSS may not be full of classes like .red, .blue, 
Previous Message
Next Message

Message thread: