Call (877) SITE-OPT (748-3678)

Extreme XHTML optimization

The "X" in XHTML signifies HTML's addition to a large family of extensible, interoperable, and self-describing markup languages. This is the Extensible Markup Language (XML) family, which defines a general way to create application-specific markup languages for different purposes. The XML clan frequently welcomes new members, including XHTML, Scalable Vector Graphics (SVG), and Rich Site Summary (RSS) for news syndication. In this chapter you'll learn how to push XHTML to extremes, but abide by the family rules.

Summary

Due to its stricter rules, XHTML can use a subset of the optimization techniques you learned for HTML.

  • Remove whitespace.
  • Minimize HTTP requests (replace images with CSS).
  • Cut the comments.
  • Minimize alt attribute values.
  • Use conditional meta tags.
  • Optimize forms.
  • Tune tables with table-layout:fixed and colgroup/col elements.
  • Auto-abbreviate URLs.

XHTML-specific tips

  • Transform your code into a more standards-compliant mode for smaller files and lower maintenance costs.
  • Adopt strict XHTML for faster downloads and parsing.
  • Create well-formed documents, close all tags, and fully qualify and quote all attributes.
  • Use lowercase markup and text.
  • Embed style sheets on high traffic pages and link to external files everywhere else.
  • Link to external scripts, and group, compress, and defer where possible.
  • Minimize fragment identifiers.
  • Validate your XHTML; use HTML Tidy to clean up your code.

Further Reading

Books

HTML & XHTML: The Definitive Guide, 5th ed.
Chuck Musciano and Bill Kennedy, (O'Reilly, 2002). A great introduction and reference for markup.
Inside XML
Steve Holzner (New Riders Publishing, 2000). For more details on XML's inner workings.

Article Highlights

Almost standards mode
Mozilla.org on their new DOCTYPE switching mode.
Extensible Markup Language (XML) 1.0, 2d ed.
Tim Bray et al., (World Wide Web Consortium, 2000). The XML specification.
JavaScripting Netscape 6: No More Sloppy Code
Andrew King (Jupitermedia Corporation, 2001). Improperly nested HTML can cause unexpected behavior in some dynamically written JavaScripts in Netscape 6.
The Semantic Web
Tim Berners-Lee, James Hendler, and Ora Lassila, Scientific American 284, no. 5 (May 2001): 34-43. See also SemanticWeb.org.
XHTML 1.0: The Extensible HyperText Markup Language, 2d ed.
Steven Pemberton et al., (World Wide Web Consortium, 2002). A Reformulation of HTML 4 in XML 1.0.

Software

Tidy
Tidy is a powerful code cleaner that can convert your HTML into XHTML, your fonts into CSS, and even optimize your code (-o option) by removing whitespace. Tidy has been ported to Java and Perl, a number of platforms (including DOS, Windows, and Mac), and embedded in a number of third-party programs, including BBEdit, EVRSoft's 1stPage, HTML Kit Web Editor, Notetab, and Mozquito Technologies' Factory.
Dreamweaver Extensions
From Jason Dalgarno that convert HTML pages into XHTML. See also Macromedia's Dreamweaver exchange.

General XHTML Resources

CSS Support Charts
Eric Meyer. The master CSS reference grid.
The Web Standards Project
Jeffrey Zeldman et al., (1998).
XHTML 1.0: The Extensible HyperText Markup Language, 2d ed.
Steven Pemberton et al., (World Wide Web Consortium, 2002). A Reformulation of HTML 4 in XML 1.0.
XHTML 1.1 - Module-based XHTML
Steven Pemberton et al., (World Wide Web Consortium, 2001). This version of XHTML is a reformulation of XHTML 1.0 strict based on modules.
XHTML 2.0 W3C Working Draft 5 August 2002
Steven Pemberton et al., (World Wide Web Consortium, 2002). Fully modularized version of XHTML not designed to be backwardly compatible with XHTML 1. Strict, only one DTD available.
Copyright © 2002-2013 Website Optimization, LLC. All Rights Reserved - Free website speed test - Privacy Policy
Last modified: January 11, 2010.

Follow us on: Twitter, Google+, Facebook, Linked In