Basically, XHTML is HTML defined and executed as XML. XHTML is written in similar to the HTML syntax, but stricter. XHTML combines the advantages of both XML and HTML, it’s supported by the majority of browsers and editors. The XHTML script is an extended version of HTML, which was introduced in 2000 to improve HTML’s flexibility and compatibility with other formats. However, there are some differences between the HTML and XHTML syntax and the way some other scripts are processed in XHTML (for example, CSS and JavaScript, due to the case-sensitivity of XHTML). To make sure that the XHTML script is always properly executed and available for all browsers, some developers use only HTML-compatible XHTML.
Strict & Transitional XHTML DTD
There are two basic XHTML DOCTYPE versions that are most commonly used for the creation of XHTML documents. These are the Strict and Transitional XHTML DTDs. The Strict XHTML is the standard one, it requires separate structure and presentation (no layout defining markup, the whole presentation should be in CSS). The Transitional XHTML DTDincludes the presentation elements, it’s somewhere between the HTML and the Strict XHTML format. The Strict version is cleaner and the better long-time choice, but if your site visitors use older browsers and you don’t use much CSS, you may also use the Transitional XHTML DTD.
Valid XHTML and XHTML Syntax
If you want to write valid XHTMLscript you must observe a few rules. Unlike HTML, XHTML elements must be always closed, with closing XHTML tags (“<“p> and “<“/p>) or single self-closing XHTML tags (“<“/hr>). XHTML is case-sensitive, so the elements and attributes must be in lowercase. Unlike the HTML markup, XHTML attribute values must be always quoted. Attribute minimization or “short tags” isn’t allowed for XHTML. It’s absolutely necessary to define the XHTML DOCTYPE in the beginning of the document. These are the basic requirements. However, there are some parsing errors that might occur for XHTML files, so you should be always careful and make sure that you use valid XHTML script.