feck Posted November 27, 2006 Share Posted November 27, 2006 Hi How do you go about using multiple stylesheets?What I would like to achieve is to have a stylesheet to render the basics of a page such as color schemes and navigation, and then use another stylesheet to further render individual pages.Do I call two stylesheets in the header section of each page?Or is there a way to call on the main coloring stylesheet in the page stylesheet? Link to comment Share on other sites More sharing options...
boen_robot Posted November 27, 2006 Share Posted November 27, 2006 There's both ways.You can insert two link elements in the head section of your page. More explicit (page) stylesheets must be put below more common ones (overall, section, etc.).Or you can call one different CSS per page and have one or more @import rules to import the more common stylesheets. Again, more common styles must be put above more explicit ones. Link to comment Share on other sites More sharing options...
feck Posted November 27, 2006 Author Share Posted November 27, 2006 thanks boenOne other question, what are the advantages of using import over a link ref, or even vice versa?If you help or direct me to some current arguments, it would be much appreciated.Thanks again boen_robot. Link to comment Share on other sites More sharing options...
boen_robot Posted November 27, 2006 Share Posted November 27, 2006 The advantages of both are that the other doesn't need to change.If you use @import rules, this means that if you had common and page stylesheet, and at one point wanted to add per section stylesheets, you'll need to go into each page's CSS and add the @import for the section stylesheet. You may also put the section stylesheet in the place of the common. The common may then be called from the section stylesheet.The (X)HTML reamains intact in all of those procedures.The drawback of this approach is that you need to change each page CSS and also that if you @import stylesheet in imported stylesheet, this creates a bond that would have otherwise be breakable.If you use several <link/> elements, this means that if you had a common stylesheet and page stylesheet, and at one point wanted to add per section stylesheets, you'll need to go into each page's (X)HTML and add a new <link/> element in it's proper place for the new CSS.The CSS remains intact and there's never unbreakable bond.The drawback is that each page's XHTML has to be edited.I'm personally more comfortable with markup and thus prefer the <link/> approach. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now