HTML 5 and XHTML 1.1

I am learning HTML 5 and wondering: Can HTML 5 be used in XHTML 1.1 documents? If so, can anyone give an example?

+4
source share
2 answers

Do not confuse XHTML and HTML.

XHTML is HTML, which is a valid XML document. In fact, the XHTML 1.1 standard does not apply to HTML 5, but to HTML 4.01.

What does it mean? You can select a valid XHTML 1.1 document and it will be a valid HTML 5 document, but the counterpart is not always true. For instance:

<button disabled></button> 

This is valid HTML (no matter which version), but it is not a valid XML operator (then it is not a valid XHTML document) due to an empty attribute. The world is full of these examples (only Google), HTML is very relaxed in terms of syntax (and HTML 5 has not changed this direction), and there are other differences ( here , for example). In addition, the HTML 5 standard introduced new tags that are not part of the XHTML 1.1 standard, so a fully functional HTML 5 document (despite the syntax) will not be a valid XHTML 1.1 document.

References
Here is a short list of good links to this topic, selected from SO answers:

+8
source

theoretically not, because the standard xhtml and html sets are different. However, if it works, it completely depends on the browser you are using, and in the most modern browser, a different set of tags will be displayed, as well as the standard that you defined.

+1
source

Source: https://habr.com/ru/post/1414094/


All Articles