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 trialSilvia Balu
8,963 PointsSolved - I can't link an external CSS to the index.html
Stage 1: Getting started with CSS. I wrote the code in Sublime 2 just like in the video for both index.html and style.css. I have a folder on my desktop called "adding-css". Inside the folder there is the index.html and another folder called "css", where the "style.css" is located.
<!DOCTYPE html>
<html>
<head>
<title>Adding CSS</title>
<link rel="stylesheet" href="css/style.css">
<style type="text/css">
h1 {
color: white;
background-color: #E14607;
}
</style>
</head>
<body style="background-color: #BDD4DE;">
<h1>Adding CSS to the Page</h1>
<p style="font-weight: bold;">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.</p>
<h2>Lorem ipsum dolor sit amet</h2>
<ul>
<li>Duis aute irure dolor</li>
<li>Nemo enim ipsam voluptatem</li>
<li>Ut enim ad minim veniam</li>
<li>ed quia consequuntur magni</li>
</ul>
</body>
</html>
css:
h2 {
color: steelblue;
padding-bottom: 10px;
border-bottom: 2px dotted;
}
ul {
color: white;
background-color: steelblue;
}
Is it something wrong with the path or why is it not working? Please help. Workspaces was much easier than Sublime...
3 Answers
Silvia Balu
8,963 PointsNevermind, I found the answer. My index.html was originally saved on desktop in Sublime and not inside the "adding-css" folder. I saved it again in the right location and now it works :)
sarup
3,352 PointsThe code itself seems fine to me. I just saved them both on my computer and ran them, and it works! I would suggest that you look more closely at the file names and paths, and make sure they are correct. For example the style.css file should be saved as a css file, not a style.css plain text file.
I hope this helps.
sarup
3,352 PointsNevermind! Glad to see you solved your problem! :)
Silvia Balu
8,963 PointsThank you! :)