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

Buckley Perkes
Buckley Perkes
2,705 Points

@import? what are the advantages and when would you actually use it...

I just finished the introduction to CSS and they introduced @import as a way to import CSS styles... Would there ever be an advantage to using this over simply adding an additional <link> to your second CSS file?

For larger projects with lots of CSS easier to manage in production. Also used alot in SASS the CSS precompiler.

Mike Bronner
Mike Bronner
16,395 Points

I would use @import in frameworks that don't have special CSS handlers. For example, WordPress has a special methods to include stylesheets, so in that case I wouldn't use @import.

1 Answer

Mike Bronner
Mike Bronner
16,395 Points

Thanks for that interesting article, James!