There is a huge debate on the web taken place among web developers for many years about using HTML vs. using XHTML for developing web pages and web applications.

In fact, thousands of articles talk about the benefits of using HTML over XHTML and also other thousands argue to the opposite direction.

At the first glance, real programmers would like to try XHTML because it is strict reminding them with the strictness of mid-level programming languages like C and C++ because XHTML, by definition, is as a standard for creating well-formed web documents.

Story of HTML5 and XHTML

In the past, appeared the concept of Markup Language, which is the concept of putting notes on text elements to give them extra meanings and advantages. After that, IBM created the GML language then ISO created the SGML standard. Then, W3C created the HTML and the XML standards. HTML was and is still used for creating web pages and the XML was used to create RSS, Atom and similar things. XML becomes an outlaw of its fatherو the SGMLو and becomes a main streamline competing with its father. Then W3C decided to create a new version of HTML based on HTML 4 but with the strict rules of XML. The product was the XHTML 1.0 standard. Then we got the HTML5 and also other versions of XHTML.

Benefits of XHTML

Struggling through the web searching for convincing reasons to convert to XHTML over HTML, you will come to the conclusion that XHTML’s lonely and only pro is that it is recommended by W3C and because it supports Unicode.

For example, if you want to use the following tag:

Pitfalls of XHTML

After a long research and after I tried XHTML myself I would summarize XHTML pitfalls with the following points:

  1. Lack of web browsers support: Although XHTML was released in 2000, 35% of current web browsers does not support it in desktops at all and also it has partial support on 15% of current mobile browsers and no support at all in around 60% of current mobile browsers. (Wikipedia)
  2. Inline JavaScript: The XHTML parser will not allow inline JavaScript unless you surrounded it with <![CDATA[ … ]]> which is an additional overhead for web developers.
  3. Strictness and functionality: Any single mistake in the XHTML document may render the web page nonfunctional while in HTML, browsers try their best to render even a bad-formed HTML page.
  4. Strictness and incomplete download: Suppose an XHTML web page was downloaded partially for any reason, it will be considered invalid entirely because it is not well-formed, by definition.
  5. Strictness and web productivity: Many web developers find that being too strict in creating web pages is a real pain and overhead.

Conclusion

W3C will fight to enforce XHTML standards over HTML however there are many real practical problems and overhead in developing in XHTML and also you will gain no benefits if you create XHTML documents and, to the contrary, your XHTML documents are more likely to fail in terms of lack of web browsers support, especially in mobile browsers, and strictness will render your web pages more frequently as nonfunctional. Do you know other benefits or pitfalls of XHTML?

 

Other articles by the author: