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 trialCaitlin Megonigal
2,028 PointsExternal CSS page is not linking with index.html
I am on the Web Design video track and currently I am on the Adding CSS to a Page.
Here is my code:
<!DOCTYPE html>
<html>
<head>
<title>Adding CSS</title>
<link rel="stylesheet" type="text/css" href="HTML/Treehouse Practice/Adding CSS to a page/CSS/style.css">
<style type="text/css">
h1 {
color: white;
background-color: #E14607;
}
</style>
</head>
(Just the beginning part) -- I am not sure as to why my link tag is not working. I have tried many different things and they are not working.
2 Answers
Alan Johnson
7,625 PointsHi Caitlin! It looks like it could be a path problem. Is your CSS file in the same folder as your html file? Or maybe in a CSS folder under it?
The path you're using in the <link>
tag is a relative path (it doesn't start with a /
), so it's thinking that there's a folder in the same folder as your html file named HTML
, then a folder inside of it called Treehouse Practice
, etc.
Caitlin Megonigal
2,028 PointsThank you Alan! I actually ended up taking out the whole path and just having CSS/style.css and it worked. I think the key was that the folder it is in, is named CSS (capitalized).
Alan Johnson
7,625 PointsAwesome! Be sure to mark my answer Best Answer if it solved your problem
Logan R
22,989 PointsLogan R
22,989 PointsTry adding Http:// to the beginning of the link. It should solve the problem.
Alan Johnson
7,625 PointsAlan Johnson
7,625 PointsAdding http:// to the beginning of a folder based path probably won't fix the issue since there's no hostname there. I think she's probably linking to a relative path and the folders just aren't quite right.