No. Counter-examples:
These are valid HTML5 but invalid XHTML5:
-
Some closing tags can be omitted:
<p>First <p>SecondSee: P-end-tag (</p>) is not needed in HTML
-
scriptescape magic:<script><a></script>See: What is CDATA in HTML?
-
Attributes without values (boolean attributes):
<input type="text" disabled />See: What is the correct value for the disabled attribute?
-
Attributes without quotes, e.g.:
<div data-a=b></div>See: In XHTML 1.0 Strict do attribute values need to be surrounded with quotes?
-
Implicit open elements and multiple top level tags.
Some HTML elements are created implicitly. E.g.
html. This allows the HTML to have “multiple top level elements”:<!doctype html><title>a</title><p>a</p>See: Is it necessary to write HEAD, BODY and HTML tags?
Valid XHTML that is invalid HTML:
-
CDATAconstructs with invalid tags inside -
ENTITYand other exclamation mark constructs, which allow for billion laughs: How does the billion laughs XML DoS attack work?
Valid HTML and XHTML but with different meanings:
- HTML has hundreds of named character references (e.g.
£,©), XML has only 5 (quot,amp,apos,lt,gt).