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 CSS Foundations Getting Started with CSS Adding CSS to a Page

why would you use @import css over just adding another statement?

In the CSS video, why would you use @import css over just adding another css link statement?

2 Answers

Most of the time you will not use @import.

Linked Stylesheet are loaded parallel, run faster. However @import stylesheets load one by one which means slower load times.

@import are mainly used when working with media queries.

More examples when you should use @import: https://developer.mozilla.org/en-US/docs/Web/CSS/@import

Hey Jeremy,

Like Michael said, most of the time you won't use it & it can lead to slower loading time. However, there might be times where your css code might start getting out of hand and hard to scan through to find certain pieces of code. So, @import would be used if you were to section off certain parts of your code into separate style sheets, especially if you are working on a project with others and its not just you that will have to look at the css.