Differences between HTML and XHTML

What is a HTML ?

The HTML (Hyper Text Markup Language) is a language which allows the the creation of rich content (texts, images, links, layouts...) on the Internet. A HTML file contains tags (which define the layout) and text. Here is a minimal example of an HTML file :

<title>Page title</title>
<h1>Main Title</h1>

Easy to access even for computer novices, HTML has become the Internet standard for the creation of a Web page. The browsers analyzing the HTML are generally very permissive, which means they will display a web page as accurately as possible even if some of its HTML tags contain errors.

The HTML has evolved over time, and several versions have appeared successively adding new features: HTML 3.2, 4.0, 4.01 ... For the same version, there are sometimes several variations that add or remove some technical features (eg HTML 4.01 exists in three forms: Strict, Transitional and Loose).

What is XHTML ?

Directly inspired by HTML, XHTML is a reformulation that respects the XML standard. The XML format is an extremely powerful and flexible text format. It is also very strict. Thus, an XML analyzer will not support formatting errors in an XHTML file. But when the document is valid, this rigor is rewarded. Browsers can optimize their engine, developers can optimize their pages and in the long term this will facilitate access and data structuring.

The XHTML designers dreamed that everyone would use this rigorous short-term format, but there are still a lot of websites that have not yet adopted it or, what is worse, they claim that they support it but then their pages are invalid.

In XHTML, all tags are still tiny (unlike HTML which is more permissive).

Just like the HTML, there are more XHTML versions : 1.0, 1.1, 2.0...

What is HTML5 ?

HTML5 is in this Yakaferci article

What version of HTMLor XHTML should I choose for my website ?

The best choice depends on several factors:

  • on whether your website already exists or not
  • on your computer skills
  • on the time you can devote to the website
  • on whether you want your website to be accessible even with older browsers that do not use the HTML5
  • on the complexity of your website, both in terms of dynamic AJAX-style displaying and in terms of dynamic page construction using data from a database.

Clearly, if your project is new and if you can afford to forget about the older browsers, we recommend that you adopt HTML5

If your website already exists in another HTML version from an SEO point of view it is not necessary to change the version.

Regarding the optimization for the main search engines (SEO): naturally, Google is totally capable of indexing the HTML pages in a permissive way. However, the better your pages are formatted, the better it will understand its content.

To specify which version you have chosen for your page, simply include the DOCTYPE at the beginning of the file. Here are two examples:

  • for HTML 5:
  • for HTML 4.01:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  • for XHTML 1.1:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

How to make sure that my page is set to HTML or XHTML?

To do so, simply launch a Yakaferci analysis in order to analyze the statements and launch a W3C validation.

View more

If this article has inspired you to find out more about the subject of HTML / XHTML, here are some useful links:

The free Yakaferci tool for analyzing the HTML versions used for your pages

Analyze your web pages with our free SEO Page Analyzer :

To start a Yakaferci analysis, simply enter the link to your page in the area above and click the Analyze button. You can then access the different pages of the report, especially those on HTML.

View more...

Other Yakaferci articles in the SEO and technical aspects section could also be helpful.