CSS

Caroline Louw
Caroline Louw
10,949 Points

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
MOD
Gergely Bocz
Treehouse Moderator 12,586 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.

Caroline Louw
Caroline Louw
10,949 Points

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
MOD
Gergely Bocz
Treehouse Moderator 12,586 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?