Sunday, 08 August 2004, 21:43:14 EDT

I have converted this web site back to HTML 4.01 Strict. I have been meaning to do it for a long time now but decided to quit putting it off. Why HTML 4.01 and not XHTML 1.0? That is a good question and one that will take a bit of explaining. The first thing you should do is read http://xrl.us/ba4c from start to finish.

Done? Good. Now let me explain what it said.

HTML is marked up text, hence, Hypertext Makrup Language. That means a web page is, or should be, nothing but text marked up so that user agents, i.e. your web browser, can interpret what the text means. A good example is the <h1> and the <p> elements. The first element denotes a heading level one; this is typically rendered as very large bold text by most web browsers. The second element indicates that the text is a paragraph, just like a paragraph in a book. The idea here is that a user agent can pick up certain elements and do magical things with them. Theoretically a user agent could pick out the heading elements, of which there are six, and create a table of contents for the web page. The user agent could then present you with the table of contents and allow you to navigate through the document like a book. Basically, a web page is nothing but plain text with elements describing the text. That is the most basic idea about HTML and if you can grasp that you will better understand why there are standards for web technologies (HTML, CSS, XHTML, et al).

XHTML is completely different. To understand what Extensible Hypertext Markup Language is and why it exists you need to understand what XML is and what its purpose is. XML is a textual representation of data. Let me repeat that, it is a textual representation of data. XML can be used to store settings for applications to describing the visual structure of applications. For example, in a couple of the projects I am idly working on I use XML to store user settings and such; I also use XML to describe the user interface — where the buttons should go and such. XML is very portable and quite human readable. An XML file written on one platform can very easily be used on another platform. The programs just have to be written to read it. This feature lends itself very well to the internet; at least in theory. Writing web pages in pure XML, like this one, would not be very efficient. However, writing normal web pages that can make use of XML is. Imagine for a minute if you could write a web page that works just like a normal web page yet has portions that are much more advanced than just text and images. Wouldn't you like that? Well, that is what XHTML is for. XHTML allows you to write an average run of the mill web page yet take advantage of technologies like MathML to display, and manipulate, more advanced data.

So, back to the question of why use HTML 4.01 over XHTML 1.0 on this site. The biggest reason is that there is absolutely no need for the extra features, and complexity, of XHTML on this site. This site is just text and images that is very easily read by every user agent I have used; that includes a hand held device. Another reason is that not all user agents can render a truly strict XHTML document as it calls for an XML prolog. IE renders the page in quirks mode if the prolog is present and thusly breaks a lot of the page as it makes use of some, relatively, advanced CSS features. I also converted this site to XHTML before I truly understood what and why it is. Hopefully this clears up any confusion you may, or may not, have had about the difference in HTML and XHTML and when to use which.

Categories:

I am all for the concept of K.I.S.S. - "Keep it Simple Stupid". If I can get away with HTML, then I will do such. On a website like a blog with comments, HTML and PHP are really all that is needed. Maybe some CSS to manipulate the look. XHTML is overkill for a project like this. It is good that you know it and can code it as strict though. Jon opportunities later.

Posted by Mr Frosti on Monday, 09 August 2004, 12:55:10 EDT.

Very nice blog.

Posted by Gergana on Thursday, 01 September 2005, 16:26:41 EDT.