Is the colon: valid in attribute names for HTML (5)?

Is a colon: character a valid attribute name in HTML (5)? A.

Like this:

<p he:llo="world" >Hello world</p> 

After searching the Internet, I found this article:

http://razzed.com/2009/01/30/valid-characters-in-attribute-names-in-htmlxml/

This suggests that it is valid, but it refers to this w3 document:

http://www.w3.org/TR/2000/REC-xml-20001006#NT-Name

But this article is entitled "Extensible Markup Language (XML) 1.0 (Second Edition)" - value, XML, not HTML.

Can anyone clarify this for me?

+8
html html5
source share
1 answer

This is used for XML namespaces and should not be used for other purposes as per the specified document:

Namespaces in XML Recommendation [XML Names] assign a value to names containing colon characters. Therefore, authors should not use a colon in XML names other than namespace purposes, but XML processors should accept a colon as a name character.

HTML5 supports both XML mode and non-XML mode . I would stay away from colons except namespace delimiters.

+5
source share

All Articles