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
Zach Perry
1,303 PointsIndex.html is acting weird ...
I've been working on a project recently with what I'm learning from Treehouse. I barely touched the code, before I noticed that none of my CSS worked for my main page. It works fine for all my other pages. Other pages on the project works with the CSS. I've read over the code a billion times, and I spot nothing out of the ordinary ... as it matches the code from the other pages. I didn't change directories either. The title tag went from 'Page' to 'Page.html'. Any idea on what is causing this? Any help is greatly appreciated, as it helps me grow as an aspiring developer. Thank you for your time. Here is my head code:
'''<head>
<title>Punk'n</title>
<title>Punk'n | Dinner</title>
<link rel="shortcut icon" type="image/ico" href="icon.ico"/>
<meta http-equiv="content-type" content="text/html", charset ="utf-8" />
<meta name="keywords" content="thanksgiving, procrastinator, easy, recipes">
<meta name="description" content="Take the stress out of Thanksgiving">
<meta name="author" content="Zach Perry" >
<link href='http://fonts.googleapis.com/css?family=Nunito' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
<link rel ="stylesheet" href="punkn.css">
</head>'''
4 Answers
Robert Richey
Courses Plus Student 16,352 PointsHi Zach,
It's pretty hard to imagine what may be the problem without seeing any code. Can you paste the head section from your main page? Try using Markdown to make it easier to read.
Cesar Vanbuskirk
6,672 PointsIf you're CSS is in a CSS folder make sure you link to that folder <link rel="stylesheet" href="css/style.css">
Robert Richey
Courses Plus Student 16,352 PointsI'm not seeing any problems with syntax. Cesar has a good idea, and to be more general about it, are you certain that 'punkn.css' is at the same level as your index.html, because that's a relative path being used. If that checks out OK, next I'd double check spelling... beyond that, compare this head from the head in other pages that load the CSS file correctly.
I know what it's like to have problems like this, and it's really frustrating. This will help you develop a mental checklist of troubleshooting steps. For example, one annoying problem I kept having was that after writing and saving CSS files, it wouldn't work at all for my index page - similar to your issue, but a different cause; I just kept forgetting to actually link it to my index file. Anyway, I hope you're able to trace your steps and work out what is different about the main page from the other working pages.
Cesar Vanbuskirk
6,672 PointsIt's best practice to place your css in a css folder, and also to label your main css file "style.css" so that in the future when other developers work with your code they know what everything is. Create a folder on your desktop and place your index.html in it, create a folder in that folder named css and place your css file in it (re-name it style.css). Now link to your file using href="css/style.css".