• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Combining Style Sheets

Thanks to the properties of inheritance and cascading, you can have external sheets on one page or have an external page and an internal style on the same page. Remember that the “cascading” in CSS means that styles can be additive and the code closest to the actual element trumps higher-level style rules. Understanding the benefits and drawbacks of combining sheets will enable you to take full advantage of CSS.

External style sheets are very useful because they enable you to specify many parameters for your site in a central location, and therefore these style parameters are easily updateable. You can change the look of thousands of pages by changing one line in the style sheet. This kind of power goes both ways. You can easily change every <h2> tag in your site by updating the selector on the external style sheet. If you have a certain section where you need the <h2> tags to be different from all the rest, however, this external style will not help you. You can use the cascading principle to your advantage by combining your external style with an internal style for those specific pages. Because the internal style is closer to the actual H2 element, the external style sheet, the internal rules will be used and your section will look correct.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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