W3C home > Mailing lists > Public > www-style@w3.org > December 1995

Re: draft-ietf-html-style-00.txt & class as a general selector

From: Hakon Lie <Hakon.Lie@sophia.inria.fr>
Date: Fri, 8 Dec 1995 14:31:39 +0100
Message-Id: <199512081331.OAA20567@www4.inria.fr>
To: lilley <lilley@afs.mcc.ac.uk>
Cc: www-style@w3.org
lilley@afs.mcc.ac.uk writes:

 > > > [CLASS="foo"] { color: blue }
 > > > *.foo { color: blue }
 > > > .foo { color: blue }

 > In the third example, .  means "a class called" but this does not seem
 > to scale well, particularly when CSS is later used for other DTDs which
 > might not have a class attribute (or might have one that means something
 > else)

In CSS1, which is HTML-specific, '.' is a shorthand for "a class
called". CSS2 will introduce a way of declaring what attribute '.'
refers to:

  @archform CLASS

This is hidden in the formal grammer part of the specifications that
discusses CSS2.

 > Let's use @ and = for these, though the representation
 > could be some other token.  I just thought @ (at) was memorable for
 > "attribute" and = seemed obvious for "has the value"
 > 
 > We then have (spacing is up to you):
 > 
 >  bar { something }                  all bar elements
 >  
 >  bar @CLASS = foo { something }     all bar elements with class attribute foo
 >  bar @ID = foo { something }        all bar elements with id atribute foo
 >  bar @LANG = foo                    all bar elements with lang atribute foo 
 >                                        (and so on)
 >                                        
 >  @CLASS = foo { something }         all elements with class attribute foo

I like the '@' mnemonics. Perhaps we can rearrange our previous use of
the character..

 > Which seems fairly regular and easy to parse - properly bracketed.  Then
 > for notational convenience, when using CSS with HTML, we have the
 > following short forms:
 > 
 >  . means  @CLASS = 
 >  # means  @ID =         or whatever token is chosen

Having a shorthand for ID is not only a syntactical convenience;
knowing that the attribute is unique will help implementors. We were
thinking about a different shorthand:

  "x67y" { .. }

 > So
 >  
 >  bar.foo {something }         all bar elements with class attribute foo
 >  .foo { something }           all elements with class attribute foo
 >  #42 { something }            the element with id attribute  42
 > 
 > This gives a concise and regular notation, it seems.

Yes, and is very much in line with CSS thinking. A few questions
remain:

 - should one also allow the more verbose versions (CLASS=foo,
   ID=x67y) in CSS1?

 - what do people prefer, 
 -- #x65y or "x56y" ? 
 -- @CLASS=foo or [CLASS=foo] ?

Regards,

-h&kon

Hakon W Lie, W3C/INRIA, Sophia-Antipolis, France
http://www.w3.org/People/howcome  howcome@w3.org
Received on Friday, 8 December 1995 08:32:26 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:53:43 GMT