• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

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.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint