Summary

 < Day Day Up > 



We've looked over four different methods for applying CSS to markup, showing that each has its merits depending on the situation. Let's recap the methods and the advantages and disadvantages that they each may have.

Method A:

  • Requires styles to be in the <head> section of each document. Can't share with multiple documents and is required to be downloaded each time the page loads.

  • Styles contained in the <style> element won't be completely hidden from all older browsers.

  • Good for testing and development stages. Markup and style can each be modified in the same file.

Method B:

  • Enables one set of styles to be shared among multiple documents or an entire site.

  • External style sheets are downloaded once and often cached by the browser, saving download time for repeat visits.

  • Keeping shared styles in one file means easy maintenance for design updates.

  • Styles referenced with the <link> element won't be hidden from older browsers.

Method C:

  • Enables one set of styles to be shared among multiple documents or an entire site.

  • External style sheets are downloaded once and often cached by the browser, saving download time for repeat visits.

  • Keeping shared styles in one file means easy maintenance for design updates.

  • Using @import hides styles from Netscape 4.x browsers.

Method D:

  • Styles are coded inline, keeping the design too closely tied to the markup.

  • Styles can't be shared among other elements, entire documents, or sites.

  • Maintenance can be tedious and inefficient.

  • Good for temporary solutions or when accessing an external file of the <head> of the document is impossible.

Now that we've recapped the various ways that we can link up our styles to our markup, let's go a step further in the "Extra credit" section to take a look at alternate style sheets.



 < Day Day Up > 



Web Standards Solutions. The Markup and Style Handbook
Web Standards Solutions: The Markup and Style Handbook (Pioneering Series)
ISBN: 1590593812
EAN: 2147483647
Year: 2003
Pages: 119
Authors: Dan Cederholm

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