Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,621 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?