Previous Message
Next Message

Rule of Thumb For Naming Classes/IDs?

Sent by Alan Gresley on 31 March 2011 11:11


On 31/03/2011 2:01 PM, Philippe Wittenbergh wrote:
>
> On Mar 31, 2011, at 12:09 AM, Elli Vizcaino wrote:
>
>> So I guess, in essence the answer is NO you cannot begin a class or
>> ID name with numeric characters?
>
> The answer is no. Isn't the css2.1 spec clear enough ?
> <http://www.w3.org/TR/CSS21/syndata.html#characters>


This is not correct. You can begin ID and class selectors with numbers. 
The only thing is that they must be encoded properly with characters 
escapes (the above spec gives details).

<http://css-class.com/test/css/selectors/identifiers-character-encoding2.htm>


It would be very wise for every one to study the source code showing CSS 
and HTML. IE9, FF3.6.16 and Opera 11 parses this correctly. WebKit fails 
with the blue border.

This is the CSS.


#\31\31\31\31 { background: lime }

   equals   #1111 { background: lime }


.\32\32\32\32 { background: #\0030\0066\0030  }

   equals  .2222 { background: lime }


.\06B0 { background: lime }

   equals  .Ú° { background: lime }


\0064\0069\0076 { bac\k\g\r\o\u\nd: lime; border: 10\0070\x solid 
\0062\006C\0075\0065 }

   equals   div { background: lime; border: 10px solid blue }


Character escapes play an impotent role is CSS tokenization (I'm still 
learning).

<http://www.w3.org/TR/CSS21/syndata.html#tokenization>



-- 
Alan http://css-class.com/

Armies Cannot Stop An Idea Whose Time Has Come. - Victor Hugo
______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread:

Possibly related: