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

when i create a repo on github , i wanted to view my webpage using treehouse but it didn't want to connect to the css

the stylesheet i created doesn't want to connect to the html file. So, it just shows the html on the webpage. What happened to the css file and why doesn't it want to show?

2 Answers

Gergely Bocz
Gergely Bocz
14,244 Points

Hi Caroline!

I think it is due to pathing.

Have you tried putting the css file next to the html and linking from there?

The same happened to me when i used file paths relative to the root folder (so starting with "/" for example "/css/styles.css"), because the root folder is username.github.io in this case, and not username.github.io/repository.

yes, i tried putting them next to each other but it doesn't appear on github. so you're saying i should remove the css file from the css folder and place it in the same folder as the html file?

Gergely Bocz
Gergely Bocz
14,244 Points

Well my point is, that if the css works normally when you view your page locally, then the problem may be caused by pathing issues. And that issues is easiest to solve by putting your css file next to your html, although it should work fine if you set the path to your css file mindfully. If it works fine locally and the issues is not due to pathing, then i don't know what the source of the problem may be.

Are there any errors in the console? Both in the local and in the github version.

Or can you perhaps copy the link tag with the file structure, so that i can check if it should work on github?