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

Kashmira Changade
Kashmira Changade
1,492 Points

Linking the Stylesheet to index.html

In the video the stylesheet is the linked to the html document, using the below code,

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

Shouldn't the href value be "../css/style.css" ? As index.html and style.css are not in the same folder

1 Answer

href="style.css" would be used if index.html and style.css are in the same folder.

  • ProjectFolder
    • index.html
    • style.css

href="css/style.css" would be used if index.html and the folder css are in the same folder.

  • ProjectFolder
    • index.html
    • css
      • style.css

href="../css/style.css" would be used if the folder containing index.html and the folder css are in the same folder.

  • ProjectFolder
    • htmlFolder
      • index.html
    • css
      • style.css