When declaring an attribute value such as id="attributeValue" are there any particular rules on what characters are/aren't allowed?
I have always assumed that the first letter must always be a letter (a-z or A-Z) followed by pretty much any character(s). Then I realised this is the rules for declaring PHP variables
So what are the rules for declaring an attribute, and are they the same for all attributes e.g. id, name, href, type etc
ID and NAME tokens 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 (".").
http://www.w3.org/TR/html401/types.html#h-6.2
So, your assumptions is pretty good, but "followed by pretty much any characters" is a bit optimistic.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With