calender January 17

Difference between XHTML and HTML

2010

Often the relationship between HTML and XHTML pages is an area where you can get into confusion while being on the web. Irrespective of where you stand on the novice to expert scale when it comes to computer languages and terminologies, it is important that you know the basic information and distinction between HTML and XHTML because this would always assist you to use it in future at least, if not now.

HTML (Hypertext Markup Language) and XHTML (Extensible HTML) are “markup languages” because they include tags to indicate formatting, structure and layout. HTML was originally SGML (Standard Generalized Markup Language) application. Both HTML and XHTML are almost similar to each other with the exception of a few minor points, as XHTML was derived from HTML only to conform to XML (Extensible Markup Language) standards and is just a migration from HTML.

The primary distinction between the two is that the XHTML is the strict version of HTML and possesses rigidity in its approach as compared to HTML which is flexible markup language while ignoring some lapses in structure and coding. The migration of the XHTML from HTML was due to the fact that pages coded in the HTML do not look the same in all browsers always, but HTML would still be opted for, in large cases.
Many HTML tags do not exist in XHTML as they do not include presentation tags such as font tags, etc because the XHTML demands the use of Cascading Style Sheets (CSS). Moreover, the tags in XHTML documents must have only one root element and the tags are closed, properly nested and are case sensitive because they must be written in lowercase only, and all the attributes must be in quotes. But in HTML, the document can be still opened while violating these norms and without errors.

Since XHTML has inherited the features of XML, it necessitates the declaration of the DOCTYPE which guides what rules your document should follow whether strict, transitional or frameset. The strict DOCTYPE requires that no lay out information is included in the file where as the transitional DOCTYPE includes some layout information; whereas HTML which does not require any such declaration format.

Leave a Reply