HTML and XHTML are markup language in its own and XML format respectively. XHTML is primarily designed for XML based applications. Both of them are markup language meant to publish online/offline articles with headings, text, tables, list, photos, videos, external applications integrations, etc.
It is the skeleton for a web page, containing:
You can make a choice to follow the standards or customize it. Whenever there is a such customization, it must be "willful violation" and be sure to document these violations to ensure smooth cupport. (§ 1.5.2).
They are incompatible when it comes to DOM rendering (§ 1.6). XHTML has a strict syntax representations like each tag must have its close pattern. However, practicing a good discipline of writing allows one to write a HTML compatible XHTML code but not the other way round. The standards wants author to:
Content-Type
in your response construction by defining the media type of the contents (MIME-type).<meta http-equiv="Content-Type" content="text/html" />
<meta http-equiv="Content-Type" content="
application/xhtml+xml" />
<!DOCTYPE html>
<html>
<head>
<title>Sample page</title>
</head>
<body>
<h1>Sample page</h1>
<p>This is a <a href="demo.html">simple</a> sample.</p>
<!-- this is a comment -->
</body>
</html>
Now that you understand the HTML and XHTML, it's time to proceed to the next topic.