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

HTML How to Make a Website Creating HTML Content Include External CSS

Elena Paraschiv
Elena Paraschiv
9,938 Points

If the css would not be in a folder and instead indented the same as the html file

Would it then be a good practice to link it inside the html as <link rel="stylesheet" href="normalize.css"> instead of <link rel="stylesheet" href="css/normalize.css"> as it would be in the folder.

2 Answers

Hi Elena,

If your stylesheet was within a css folder your code would look similar to this:

<link rel="stylesheet" href="css/style.css" type="text/css">

The file structure might look as follows:

  • index.html (file)
  • css (folder)
    • style.css (file)

whereas if it was at the same level as index.html it would appear as follows:

<link rel="stylesheet" href="style.css" type="text/css">

The file structure might look as follows:

  • index.html (file)
  • style.css (file)

Is this what you mean?

-Rich

If I understand what you are asking, you would leave the /css off of the path to the css file. That is the path. If the file is not where you say it is, it will not work. It is not a matter of best practice. It is the only practice.