W3C home > Mailing lists > Public > www-qa@w3.org > March 2004

Re: QA: Good CSS class names

From: Al Gilman <Alfred.S.Gilman@IEEE.org>
Date: Wed, 10 Mar 2004 17:15:59 -0500
Message-Id: <>
To: (wrong string) Žl-Massieux <dom@w3.org>, Sybren StŁvel <sybren@thirdtower.com>
Cc: www-qa@w3.org

At 06:26 AM 2004-03-09, Dominique HazaŽl-Massieux wrote:
>Hi Sybren,
>Le lun 08/03/2004 ŗ 23:59, Sybren StŁvel a ťcrit :
> > I've written a tip about giving your CSS classes a good name. I hope
> > you all
> > like the tip, and place it online!
>Thanks for your contribution! I've put the draft on-line:
>linked from the Tips page:
>hence the review period for it starts today. If anybody has comments on
>it, please send it before March 23rd
>Here comes my own feedback:
>- I like the ideas that the draft develops; I think it's a useful
>addition to the tips we already have in place


>- the title refers to "CSS class", whereas the class attribute is part
>of HTML, and can have other usages than simply applying CSS; I would
>therefore suggests changing it from "A CSS class gives an element a
>role" to "Use <code>class</code> with semantics in mind"

I also had a twinge about this.

The problem is that web authors think that 'class' in HTML
is defined by CSS; and in operational terms, it is.  Because
the CSS is the only thing that senses and acts on the
'class' marks, with very few exceptions.

>- rather than "role" which is not necessarily easy to understand when
>applied to a language, I propose to use the term "semantics" which is
>well anchored in the languages description

Here I would beg to differ.

'Role' is pretty standard language in UI design.

'Semantics' is something that is interpreted differently by most
people using the word.  And to too many it means "academic
fine points not worth worrying about."

We are not talking about a language, we are talking about a
user interface or a document.  An instance.  Subclassing
objects finer than the class information provided by the
element type name.

The role is the 'allocated function in context.'  That is what
we want captured.

This is the standard term in accessibility APIs and UI design.

It is the term that we are using in XHTML2 to carry such information.

'Semantics' on the other hand does not have one meaning in common use.
The most common use that I am aware of in N. America is erroneous,
people saying "well, let's not get sidetracked into arguing of something
that is just semantics" when they mean that the semantics is the same
but the terminology is different.  Nothing could be farther from the
technical meaning of the term.

And in terms of dealing with web designers, the fact that 'role' is commonly
used in UI design means that it is something that they are likely to be
aware of.  On the other hand, what is needed here is 'meaning' not
'semantics' in the technician's view.

>- it may be worth adding a note that this fits in the more general
>principle of separating content from presentation

Yes, and it amply demonstrates that asking people *abstractly* to abstract
the presentation out of their content, and they won't know what to do and
will claim it's impossible.  But give them the opportunity to reuse content
morsels across different presentations, and they get the idea.  So
motivating good 'class' tokens on the basis of re-use and longevity of
applicability; that's about as good as we can get for the Saturday morning
webWriter, who doesn't have a multi-channel service-delivery problem [like
that addressed by the Device Independence group] hanging over her head.


PS:  I am concerned to know if there are browsers out there that
fail to process the 'class' token list right.  Are there browsers that
don't understand what set of tokens they have received when there are more
than one?  Or which only deal with the first in the list?

One of the 'class' usage reforms that we should be pushing is characterizing
a given element by a combination of traits.  Using more than one class token.
Does this work with real HTML+CSS implementations?  It is per specification,
but most users only use one 'class' token which is the name of the style to
be applied to that section.

Please also see

  class use (notional vs. blindless grouping) from Al Gilman

.. and the other notes you will find from


>Thanks again for your contribution!
>Dominique HazaŽl-Massieux - http://www.w3.org/People/Dom/
Received on Wednesday, 10 March 2004 17:17:25 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:40:35 UTC