Welcome to the Treehouse Community
Looking to learn something new?
Tony BrownCourses Plus Student 1,678 Points
Instead of using @import in the external css, couldn't we reference the normalizing stylesheet in the head of the html?
Instead of using @import in the external css, couldn't we reference the normalizing stylesheet in the head of the html using a style element, like below?
Instead of have the following at the top of the external css file to normalize the css: @import "import-styles.css";
Couldn't we also do the following inside the head of the html?
<link rel="stylesheet" href="css/import-styles.css"> <link rel="stylesheet" href="css/style.css">
Ryan FieldCourses Plus Student 21,241 Points
You certainly could, and in fact, if you have a lot of CSS files, that way might be better since the
@import directive causes the browser to make another call instead of loading it asynchronously. With CSS preprocessors like Sass, this is less of an issue since all your CSS goes in one file, but in general, I believe it is best practice to refrain from making too many
Guil HernandezTreehouse Teacher
Hi Anthony Brown,
Sure you can. They both require an extra request to the server – they're just being made from different locations.
In most cases, you're better off linking a style sheet since
@import blocks parallel downloading. The browser has to wait to
@import a file before downloading the rest of the file...