HTML5: Valid characters for the ID attribute
Posted August 2nd, 2010 in HTML and CSS
A while back I posted the rules around the use of the HTML ID attribute; the post was specific for HTML4 and I obviously need to post an update to allow for HTML5 which is a lot more flexible.
HTML5 id attribute
It's pretty simple really, the HTML5 id attribute can contain any character other than a space, and it can also start with any character. Obviously there may be some backward compatible issues if you do start using any old character in your id attributes, but the older browsers are generally fairly relaxed at allowing most characters anyway.
For more information and a bunch of examples, read the post "The id attribute just got more classy in HTML5" on Mathias Bynens' blog. There's some useful comments on that page as well.
Related posts:
- CSS3 rounded corner input (Tuesday, April 26th 2011)
- HTML5 Tips, Tricks and Techniques (Wednesday, July 28th 2010)
- HTML5: Wrap Block-Level Elements with anchor tags (Tuesday, July 27th 2010)
- Valid characters for the HTML ID attribute (Saturday, April 4th 2009)

Comments
blog comments powered by Disqus