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 Basics (2014) Getting Started with CSS Importing Style Sheets with @import

savan patel
savan patel
2,272 Points

@import is not workming in external style sheet

@import "css/import-styles.css";

if i use upper text in my html it works nut when i use this in my external stylesheet its not working snymore so what sould i do ?

Christof Baumgartner
Christof Baumgartner
20,864 Points

You said "when i use this in my external stylesheet". When you are using this in your external style sheet, you don't have to specify the path to your css-directory. So

@import "import-styles.css";

in your external stylesheet should work.

Alternatively you could add

<style>
@import "css/import-styles.css";
</style>

to your index.html

2 Answers

Another style to this is also: <style> @import url("style.css"); </style>

To add url after @import as you can see works for me.

savan patel
savan patel
2,272 Points

i got it man thank you