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!

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 Foundations Selectors Type Selectors

style.css not showing up in index.html

I have been following along in NotePad using Chrome on an Asus that uses Windows 7. For some reason my index.html is not reflecting the changes I have made in style.css. As far as I am aware I correctly linked the two documents using <link rel="stylesheet" href="css/style.css"> in index.html. I do have files nested within each other however and was wondering if that is why I am having issues. Please help me troubleshoot this problem! Thanks :)

5 Answers

Jeremy Frimond
Jeremy Frimond
14,470 Points

Alyssa Hetland Im am going to start with the simplest potential issue first- have you saved the css sheet and the html sheet after linking and making changes?

Next, if you could post your code you are using to link the too (from the index.html) it would help out to see if there are any typos.

If you do not wish to do so, then I would recommend checking the pathway for your css sheet on your html page. sometimes, especially when a lot of nesting is involved, the pathway is incorrect and your html page cannot find your css sheet.

BOL

Yes I have saved both css and html sheets after each change. The code that I am using was what the video told me to write which is: link rel="stylesheet" href="css/style.css" (with of course the opening and closing brackets) I hope that gives you a better clue as to what I did wrong!

Jeremy Frimond
Jeremy Frimond
14,470 Points

Alyssa Hetland which folder is your css file saved in? your href could be where you are going wrong. First, mae sure your style.css file is saved in a folder titled css. If that folder "css" in within another folder then you need to mark that in the pathway for the line of code to follow and find the style.css.

for example, if I have a style.css file saved in a css folder, which that folder is saved in another folder called "work", then that folder is in another folder called documents I would need to tell the code to follow that pathway. documents>work>css>style.css

I would enter the following code into my html page:

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

sometimes putting css/style.css isnt enough for the html page to be able to find it. I would suggest your start figuring out a route. When I am working on a new project I like to keep the file in a folderon the desktop so the pathway remains simple. have one folder called project inside that folder save your index.html and have another folder called css. Inside the css folder put your style.css page as well as a folder titled img for your images.

Well thanks for the tips. I have tried everything you have suggested and nothing seems to be working. I did not have a good route on my link so I tried that and I even tried re-saving everything onto the desktop to simplify the route but nothing changes when I re-open index.html in the browser. I'll try starting over from scratch on the videos and keep your tips in mind when saving. Hopefully starting over I will not have the same problem.

Brian Molkovich
Brian Molkovich
11,333 Points

Hello, can you send me the archive file or to somewhere to put, for example on Codepen?