Can XHTML and HTML class attributes value start with a number?
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a way to play audio on a mobile browser w
- HTML form is not sending $_POST values
- implementing html5 drag and drop photos with knock
-
Why does the box-shadow property not apply to a
No, they cannot. They must begin with a letter. Some browsers may erroneously support them, though.
EDIT: You can start off with unicode escape points and specify the code for a number.
EDIT #2: Test case http://work.arounds.org/sandbox/66/run
From the CSS spec:
No. They have to be SGML names. They "must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").
However, class names that start with a number are supported by IE.
EDIT: meder pointed out that you can use Unicode characters and they seem to work in all browsers. I don't know if it complies with the specifications, but it does seem to validate. See http://css-tricks.com/unicode-class-names/ and http://snook.ca/archives/html_and_css/unicode_for_css_class_names