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 trialAli Corlett
Courses Plus Student 1,359 Points<h1> adding purple colour to the this tag on the css stylesheet. Why is this not working?
<h1> tag I have tried to add a white backround tag to ensure that the <h1> tag colour code will change. it is not. what am I missing?
<!doctype html>
<html>
<head>
<link href="styles.css" rel="stylesheet">
</head>
<body>
<h1 class="h1">Welcome to My Web Page!</h1>
</body>
</html>
body {
colour: #fff
}
.h1 {
font color: #4B0082;
}
1 Answer
jacobproffer
24,604 PointsHey Ali,
A few things to note.
First, you're currently selecting a class called h1 in your stylesheet. Instead, you'll want to select all h1 elements.
h1 {}
Secondly, font-color is not a valid property. You need to use the color property.
h1 {
color: red; /* As an example, I've set the color of the h1 to red */
}
Lastly, you'll want to use the color value purple and not a hex code.
h1 {
color: purple;
}
andren
28,558 Pointsandren
28,558 PointsThey should also remove the
body
rule. The task does not ask for one and spellingcolor
ascolour
is not valid in CSS.jacobproffer
24,604 Pointsjacobproffer
24,604 PointsSurprisingly, the challenge still passes with the body selector and incorrect property. The challenge currently only checks for the h1 property.
andren
28,558 Pointsandren
28,558 PointsIt seems you are correct, I changed my comment to reflect that it is not a required change, but really that's more of a fault with the code checker in this task than anything else. It really should fail any code that uses an invalid property.