Get Updates Via Email


  • XHTML Pitfalls

    XHTML (Extensible Hypertext Markup Language) extends versions of HTML, the language in which web pages are written.  HTML used to be defined as an application of Standard Generalized Markup Language (SGML), which was very flexible. XHTML is an application of XML, a subset of SGML that is not so forgiving!  HTML requires a lenient HTML-specific parser, but XHTML can be parsed with a more specific type because it is cleaner and more well formed.

    XHTML was originally created to make HTML easier to integrate with other data formats. It was hoped that shifting to an XML format would make HTML compatible with common XML tools, letting servers and proxies transform content for constrained devices such as mobile phones. However, the very tidiness of XML means if there are mistakes, there will be trouble for browsers trying to read the code, so XHTML validation service is recommended if you have an XML based site. Otherwise your visitors will look like this as their browser fails to read your site correctly:

    Click to view Eeeek!

    In HTML, some tags may not have closing tags, but all elements must be explicitly closed in XHTML. There are many other types of opening and closing elements that if used inconsistently or incorrectly in XHTML will cause problems with your site. For example, HTML permits omitting end tags for some elements, such as <p>, but XHTML forbids this. Also, HTML regards nearly everything as case-insensitive, but in XML all element and attribute names are case-sensitive. XHTML requires all element and attribute names to be lowercase, while in HTML documents let you mix and match cases.

    If you don’t follow the proper XHTML rules and recommendations, some browsers will parse empty elements incorrectly. XHTML 1.0 is basically a XML serialization of HTML 4.0, but HTML 5 is the first (X)HTML standard designed to support both HTML and XHTML serializations equally. Since HTML 4.01 and XHTML 1.0 are so similar, many web sites and content management systems have adopted the initial W3C XHTML 1.0 Recommendation. The W3C provided guides to help webmasters publish XHTML 1.0 documents in an HTML-compatible manner, and serve them to XHTML browsers, but many webmasters still have problems with unvalidated XHTML.

    This means that you should definitely have the XHTML validation done on your site, so you can ensure that your site is viewable with any current browser. When the XHTML is validated, all errors such as ones listed above (improper case use, incorrectly closed tags, etc) can be corrected, making your site load and display with cross browser compatibility.

Leave a Reply

Recent Posts

Share Now Facebook
Share Now Pinterest
Share Now LinkedIn
Share Now Google+">
Follow by Email