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 trialAlan Simpson
Courses Plus Student 1,572 PointsWhy is this not correct?
Why is this not correct?
<!doctype html>
<html>
<head>
<link href="styles.css" rel="stylesheet">
</head>
<body>
<h1>Welcome to My Web Page!</h1>
h1 {
color: purple;
}
</body>
</html>
4 Answers
Mitchell Fargher
11,634 PointsYou need to place that exact style you wrote in the css tab. You are placing it directly in the html which will not work.
You would be able to do it the way you are if you wrapped it in a <style> tag and placed it in the head, but it is much preferred to do it in a separate css file.
Steven Parker
231,248 PointsIt looks like you've intermixed the HTML and CSS.
Your CSS is correct, just remove those 3 lines from the index.html file and add them to the styles.css file (which is empty initially).
Remember that the HTML file is associated with content, and will be composed of elements identified by tags such as these:
<p>Here is a paragraph</p>
<div>
<ul>
<li>This is an item in an unordered list</li>
</ul>
</div>
The CSS file is associated with presentation and will be composed of selectors and groups of property names and values, such as these:
h1 {
color: purple;
}
div {
margin: 20px;
}
You had all the right stuff, you just need to get used to putting it in the right place.
Jason Anders
Treehouse Moderator 145,860 PointsThe challenge you are working on has two tabs at the top the of the challenge window. One for the HTML (index.html) and one for the CSS (styles.css).
For the challenge, you will need to click on the CSS tab and enter your code into there. So, just reset the challenge and put exactly what you had written into the HTML file into the CSS file, and you will be good to go.
And... reviewing is always a good thing. I am constantly reviewing materials. :)
Keep Coding!
Alan Simpson
Courses Plus Student 1,572 Pointsok guess I need to review again, because I do not understand.
Mitchell Fargher
11,634 PointsBasically,
All of your html will go in 1 file. In this case, index.html. All of your css will go in another file, style.css.
The code you wrote was correct, but it must be placed in the correct file for it to be processed as a style and not more html.