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 trialSolomon Gold
39 PointsI can't get Task 2 as a Beginner
Change the color of the h1 tag to purple — you can do this by creating a h1 selector and setting the color property to purple.
I just can't get, i tried still yet could not get it
<!doctype html>
<html>
<head>
<link href="styles.css" rel="stylesheet">
</head>
<body>
<h1>Purple</h1>
<p class="tag location"> purple </p>
</body>
</html>
.tag {
background-color: Blue;
1 Answer
Tobias Erich
Courses Plus Student 2,980 PointsYou can do this on a lot easier way. For the <h1> element you don't need a class attribute. For Example:
<!doctype html>
<html>
<head>
<link href="styles.css" rel="stylesheet">
</head>
<body>
<h1>Welcome to My Web Page!<h1>
</body>
</html>
This is your Challenge HTML code.
If you change the CSS to the following code, you solved the Challenge.
h1 {
color: purple;
}
You can change the color of the elements whithout any class tag. If you have more than one <h1> element on your Website and you want any <h1> tag in a different color you need different classes for them to change the color seperatly. Else you don't need a class attribute, because you only have one <h1> element on your Website.
Pavol Kocalka
9,961 PointsPavol Kocalka
9,961 PointsHello,
If you want to change h1 tag text to purple, you need to set class on tha h1 tag. You set it on <p> class instead.
Do not forget to add closing } in .tag declaration.
You used background-color CSS declaration which sets background. You need color css property to set color of the text.
Here is my suggestion html:
and css