Alex Rivera | Logout

Is HTML5 valid XML?

Asked 2011-04-05T21:05:28.957
56

I am confused. A co-worker turned me on to the possibility that tags ending in />, such as <br /> can still be used in HTML5. I thought that only <br>-style could be used. All of the "talk" across the Internet is about using the latter.

Could someone please explain this to me? This seems very confusing and poorly documented.

And this brings up another question: Is HTML 5 considered to be well-formed XML?

Edit
Report

1 Answer

3

HTML5 can be written with or without self-closing slashes; it is meant to be backwards-compatible with both HTML 4.01 and XHTML 1.0 code, so that it is easy to convert code into valid HTML5. There is an XML serialization called XHTML5, but for backwards-compatibility purposes with IE browsers, it is not recommended to be used. So technically, HTML5 is not considered to be well-formed XML.

answered 2011-04-20T21:57:08.260

Your Answer