> Giles Clark

> Just a quick question; Why should you avoid presentational 
> class names?

It goes back to the idea of separating content and presentation.
Your classnames should reflect what the element they're applied to
*is* (its qualities, if you will) rather than *how* it's displayed.

Imagine, for instance, that you decide later on that your layout needs
to be different. Rather than recode all your HTML, you want to simply
be able to change your CSS. Say you recode the CSS to a single column
layout. Now, you have pieces of HTML marked as "leftcol" or something
(can't remember your original URL, so going from memory), which now
don't mean anything anymore. Take it to an extreme (and I speak from
experience, having inherited a rather large site which used this
exact thing) and imagine somebody defining a class called "redtext"

.redtext { color: #f00; }

Great, but a year down the line they decide they want to change the
colour to green...so what do they do? They just change the CSS

.redtext { color: #0f0; }

So now you have a class called "redtext" which makes your text green.
At the very least, this becomes a maintenance nightmare. Yes, from a
technology/syntax point of view it's not an issue (the browser doesn't
care either way what the actual name is), but it makes life difficult
for you, the maintainer.

See also http://www.w3.org/QA/Tips/goodclassnames

Hope this makes sense,

Patrick
________________________________
Patrick H. Lauke
Webmaster / University of Salford
http://www.salford.ac.uk
******************************************************
The discussion list for  http://webstandardsgroup.org/

 See http://webstandardsgroup.org/mail/guidelines.cfm
 for some hints on posting to the list & getting help
******************************************************

Reply via email to