Summary

Because of its stricter rules, optimizing XHTML is more limited than optimizing HTML. For XHTML, however, you can use many of the same techniques we used in Chapter 3 and Chapter 4. You'll reap the greatest performance gains by transforming your code from old-style presentation-intermingled HTML to pure structural XHTML with CSS handling the presentation and JavaScript handling the behavior. Typical results when converting from HTML to XHTML and CSS range from 25 percent to 50 percent smaller files, with essentially the same presentation. Adopting strict XHTML means that your code will be smaller, easier to maintain and repurpose , and faster to display in modern browsers. In addition to the techniques listed previously, here are some optimization and compatibility techniques that you can apply to XHTML:

  • 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.

Recommended Reading

For more information about XHTML, check out these books and web sites:

  • HTML & XHTML: The Definitive Guide, 5 th ed ., by Chuck Musciano and Bill Kennedy (Cambridge, MA: O'Reilly and Associates, 2002). A great introduction and reference for markup.

  • Inside XML by Steve Holzner (Indianapolis, IN: New Riders Publishing, 2000). For more details on XML's inner workings.

  • http://www.alistapart.com/

  • http://validator.w3.org/

  • http://www.w3.org/TR/

  • http://www.webstandards.org/

  • http://www.xhtml.org/

 



Speed Up Your Site[c] Web Site Optimization
Speed Up Your Site[c] Web Site Optimization
ISBN: 596515081
EAN: N/A
Year: 2005
Pages: 135

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net