Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

When to use multiple stylesheets

Hi All,

I am trying to make a simple website to 'lock in' my study here so far, and I am a little confused about when it is appropriate to add multiple stylesheets to an html page.

Basically, I want to add an arrow glyph to some pages as a 'back' button. But, I of course don't want a back button on my homepage. In the CSS deep dive, they suggest using a psuedo class selector to add a glyph. In order to do this on pages other than the homepage, would I just make a glyph.css stylesheet and link it to all the relevant pages. Or would that be going about the problem in the wrong way?

Thanks so much!

3 Answers

Oops! I think I figured it out.

One could just create a div with a class of, say backarrow, and then apply the styling to that div within the main stylesheet.

Sorry bout that!

Yep, the fewer the stylesheets, the better!

The only time you want to use multiple stylesheets is when you are forced to load something from an external address. Even if you say, need a stylesheet for Internet Explorer, you can do this much better with classes as requests usually slow things down more than bits.

This will not be true in the near future as web servers will be able to serve multiple files from a single request and this will not be a big deal.