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 trialJeremy Wells
1,049 PointsChange the color of H1 to purple without using quotes?
I'm still not able to complete this challenge.. slight frustrating now. The tutorial is not very clear.
<!doctype html>
<html>
<head>
<link href="styles.css" rel="stylesheet">
</head>
<body>
<h1>class= "location"> Welcome to My Web Page!</h1>
</body>
</html>
.location
h1{color: purple;)
2 Answers
Benjamin Larson
34,055 PointsHi Jeremy,
I don't think the class declaration of location was necessary, but that seems to be where the problem is in your HTML. You closed the H1 tag before that class declaration, so if you remove the extra ">", you should be good to go.
Falk Schwiefert
8,706 PointsWhy did you put a class in the html? The challenge doesn't ask for that. If you do it, make sure that you are not having a space between the = and the ". Also make sure that the class is inside the h1 tag. you close yours and the class then hangs around alone.
In your CSS, make sure you use curly braces to open and close the object.
I would just remove that. Code checkers are kinda funky when it comes to extra code. You should pass with this:
<!doctype html>
<html>
<head>
<link href="styles.css" rel="stylesheet">
</head>
<body>
<h1> Welcome to My Web Page!</h1>
</body>
</html>
h1 {
color: purple;
}
Falk Schwiefert
8,706 PointsIf you want to use the classes, your html should look like this:
<h1 class="location"> Welcome to My Web Page!</h1>
In your CSS you always use the tag before the class or ID. While "h1" or ".location" would be fine, you can also use "h1.location" for more specificity.
h1 {
}
.location {
}
h1.location {
}