HTML and XHTML

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.

Main Purpose

It is the skeleton for a web page, containing:

  1. the contents, like markup, CSS, and javascript write-ups
  2. when and how to decorate contents with CSS instructions
  3. when and how to animate/react with Javascript

Standard Compliances vs. Customization

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).

HTML and XHTML Syntax

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:

  • be clear which type you want (HTML or XHTML)
  • state it out using Content-Type in your response construction by defining the media type of the contents (MIME-type).
    • HTML: <meta http-equiv="Content-Type" content="text/html" />
    • XHTML: <meta http-equiv="Content-Type" content=" application/xhtml+xml" />
  • author in a the HTML-compatible XHTML way (e.g. with all tags with closing etc).

Example of HTML

<!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.