Quick HTML and XHTML Comparison

This topic was published by and viewed 1470 times since "". The last page revision was "".

Viewing 1 post (of 1 total)
  • Author

  • DevynCJohnson
    • Topics - 437
    • @devyncjohnson


    • HTML5 is a revision of HTML4
    • XHTML is a bridge between HTML and XML
    • XHTML5 is an XML adaptation of the HTML5 specification
    • Most browsers support HTML, but they may not support XHTML
    • XHTML and HTML5 have different methods for presenting data
      • HTML4 is SGML-based while XHTML is XML-based
      • HTML uses the file extensions *.html and *.htm
      • XHTML uses the file extensions *.html, *.htm, *.xht, *.xhtml, and *.xml
      • HTML uses the "text/html" mimetype while XHTML uses "application/xhtml+xml"
    • HTML5 is less strict on its coding requirements unlike XHTML
      • The DOCTYPE is mandatory in XHTML
      • TheĀ "<html>" tag requires the xmlns attribute in XHTML, but not HTML
      • XHTML must have the following tags - <html>, <head>, <title>, and <body>
      • All XHTML tags must be closed, but that is not necessarily true in HTML
      • XHTML has restrictions on tag-nesting while HTML5 is not as strict on nesting
      • XHTML documents must have one root element
      • XHTML forbids attribute minimization, but not HTML
      • HTML tags are case-insensitive
      • XHTML tags and attributes must all be lowercase and attributes must be quoted


    • DHTML - Dynamic HyperText Markup Language
    • HTML - HyperText Markup Language
    • SGML - Standard Generalized Markup Language
    • XHTML - eXtensible HyperText Markup Language
    • XML - eXtensible HyperText Markup Language

    NOTE: DHTML is not its own language. Rather, "DHTML" refers to the use of HTML, JavaScript, DOM, and CSS.

    XHTML 1.0 Code

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
        <title>XHTML Sample</title>

    HTML5 Code

    <!DOCTYPE html>
        <title>Sample Document</title>
        <p>Very Basic HTML5 Template</p>
        <p>See https://dcjtech.info/topic/html5-template/ for a more advanced template.</p>

    XHTML5 Code

    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
        <title>Sample XHTML5 Document</title>
        <meta charset="UTF-8" />
        <p>Very Basic XHTML5 Template</p>

    Further Reading

Viewing 1 post (of 1 total)