How is HTML different than XHTML? Which one you would prefer to use in new Web projects and why?
XHTML (eXtensible HyperText Markup Language) is an extension of the HTML language. Regular HTML is based on SGML - which is a very complex and difficult to follow syntax. With XHTML, the W3C switched to a different code base, the much simpler XML syntax. HTML was always very open and most browsers were able to acceptably render non-standard code. Unfortunately, this led to a lot of browser-specific code that caused major incompatibilities with the different browser engines.
XHTML has much stricter specifications. XHTML code must be well formed, for example in XHTML code is always lower case, all tags must be closed or contain a closing slash, attributes must have a value etc. The validity of XHTML can be tested with the Validator of the W3C (select XHTML as the document type)
For newer projects, I would always use XHTML. Most older browser are able to render XHTML correctly. I don’t think older, outdated standards should be used unless it is necessary for legacy systems.
comments
Leave a Reply