3 ms·
Nope, that's the whole point. You’re free to use the solidus in the HTML serialization of HTML5. In the XHTML serialization of HTML5, the solidus isn’t require
by mathias 16y ago
Nope, that's the whole point. You’re free to use the solidus in the HTML serialization of HTML5.
In the XHTML serialization of HTML5, the solidus isn’t required either; you can choose to close the elements instead.
The following examples are both confirming/valid HTML5 in ‘XML mode’ (they’re valid XHTML1 as well):
a) With solidus
<img src="foo" alt="bar" />
b) Without solidus
<img src="foo" alt="bar"></img>
Just to be clear though, in my post I was just pointing out that you don’t have to change anything in your HTML4/XHTML code to switch to HTML5, except for the DOCTYPE.
- jamesbritt 16y agoThanks for the update. Some additional info here: http://dev.w3.org/html5/spec/syntax.html#void-elements http://dev.w3.org/html5/spec/syntax.html#void-elements I'm skeptical about the increased casual nature of what makes for an acceptable HTML-serialized HTML5 doc. Seems it just makes it that much harder to write a robust parser and tools. Especially the continued use of empty attribute syntax, which is just nasty. I understand it's to allow plain old HTML docs to be acceptable, but still ...
- mathias 16y agoYour question inspired me to write a post about XHTML5: http://mathiasbynens.be/notes/xhtml5 http://mathiasbynens.be/notes/xhtml5