HTML vs XHTML

Which should we use, HTML or XHTML, and why?

The W3C Responds

First, a bit of history

The history of HTML at W3C starts with HTML 3.2, code named Wilbur, which was followed a few years later by HTML 4.0, then HTML 4.01. HTML 4.01 is the last version of HTML, and is also the final W3C specification to define the semantics of markup. From HTML 3.2 to HTML4.01, the language has improved a great deal, focusing on such issues as:

  • Separation of presentation from structure
  • Improved accessibility features
  • Improve internationalization features
  • Improved document rendering

XHTML 1.0 was created shortly after HTML 4.01 to help the transition of hypertext to a new generation of mark-up languages for text. XHTML 1.1 is an additional step toward a more flexible version of hypertext with the full benefits of XML architecture and integration of different technologies. Note that XHTML 1.1 has slighly improved the semantics of HTML 4.01 by including the Ruby module, used in particular languages like Japanese scripts (read the Ruby Specification for more information). For practical purposes, the discussion here will focus on HTML 4.01 and XHTML 1.0.

The meaning of semantics

When we refer to the “semantics” of a language, we’re referring to the meaning of a given tag. HTML 4.01 and XHTML 1.0 assign the same semantics to their elements and attributes. For example, an element address has exactly the same meaning in HTML 4.01 and XHTML 1.0: they’re both used to mark up addresses. (Clarification: address is used to mark up contact information for a document.) Only bits of the syntax varies between the two languages. For example :

HTML 4.01 example

<img alt="Portrait Murakami Haruki" src="/images/murakami.jpg">
<p lang="fr">Je levai la tête pour regarder les étoiles.
Leur vue apaisa peu à peu les battements de mon coeur.</p>
<p>
  <cite>Chroniques de l'oiseau à ressort</cite> - 
  <cite>Haruki Murakami</cite>
</p>

XHTML 1.0 example

<img alt="Portrait Murakami Haruki" src="/images/murakami.jpg" />
<p xml:lang="fr">Je levai la tête pour regarder les étoiles.
Leur vue apaisa peu à peu les battements de mon coeur.</p>
<p>
  <cite>Chroniques de l'oiseau à ressort</cite> - 
  <cite>Haruki Murakami</cite>
</p>

Using technologies wisely to build more accessible websites

Once you’re ready to build your web site or web page you begin wondering how you are going to build it. Will it have tons of animations and interactivity? Will I fill it with graphics? How will all that affect the navigation, comprehension, accessibility and download time of the page? What are the things you need to consider when deciding which and how technologies will be used in your website?

Why to learn HTML code?

One of the most asked questions that come from people interested in building websites is: Why should I learn to write HTML code manually instead of using a WYSIWYG (What You See Is What You Get) editor? The answer to this question depends on the objective that each one has. Writing HTML code manually has its advantages and its disadvantages as well as WYSIWYG editors. To know which one of them is better for you, you’ll have to know their advantages and disadvantages and take a conclusion based on them and your intentions.