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

Development Tools Creating a Project Pages Site

On my GH-Pages site, CSS link doesn't work

All my content has been pushed to the GH-Pages site which is great. I've been able to push updates to the gh-pages branch via the command line. The problem is my css style sheets link is not working properly. The relative path is just href="css/main.css" which works fine on my local machine. I've tried all kinds of variatios of this and can't get it to work on gitHub.

What am I doing wrong?!

4 Answers

Blake Baxendell
Blake Baxendell
16,344 Points

Does it work when you put in the absolute url to it?

Thanks for the reply Blake. I tried that as well and it still didn't work. I'm just confused with it works locally but not when hosted on gh-pages. Maybe I need to speicify to gh-pages that I want it to be a relative link somehow? The absolutelink i used (siteurl).com/css/main.css ... the css folder is the siteurl's folder this should work, no?

Thanks.

Blake Baxendell
Blake Baxendell
16,344 Points

Normally it should. Is it showing up as a 404 in your dev tools when you go to the link? Or does it just not show up at all?

Blake, thank you for your replies, I figured it out..

So the local folder I was saving in was called "CSS" (capitalized) and I didn't realize it. When i pushed everything to gh-pages it didn't show up as capitalized, but, it was in fact trying to located the "css" directory not "CSS". Once I fixed the capital letters it found the path correctly.

Thank you for your help though.

Blake Baxendell
Blake Baxendell
16,344 Points

That will do it. Glad you got it figured out.

Aakash Srivastav
seal-mask
.a{fill-rule:evenodd;}techdegree
Aakash Srivastav
Full Stack JavaScript Techdegree Student 11,638 Points

I am facing the same problem Blake. Should I need to provide the "Absolute URL" ? And if it works , is it ok to provide url to files existing within your local computer?