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 trialChase Brenny
107 PointsHow do I change the color?
I don't know how to change the color of h1.
<!doctype html>
<html>
<head>
<link href="styles.css" rel="stylesheet">
</head>
<body>
<h1purple>Welcome to My Web Page!</h1>
</body>
</html>
3 Answers
Joseph Frazer
5,404 PointsHello, Chase. In HTML you define tags:
<h1>Hello World</h1>
These tags structure the page. To style them, you use CSS. Link your CSS through HTML with the link tag:
<link rel="stylesheet" href="pathToStyle.css">
REL tells HTML that the file is CSS. HREF tells HTML the path to the CSS. Next we need to go through the CSS. First, select the tag:
h1 {
}
That selects the HTML tag H1. You can use the same for H2-H6, P, A, and more. Now, let's change the color:
h1 {
color: purple;
}
First, we select the color property. Then we change the color value to purple to make the text purple. I hope this helps. If you need any help you can ask me. :)
Doegena Fennich
8,974 Pointsh1 {
color: red;
}
Eduard Fildiroiu
3,123 PointsIn the styles.css you have to write:
h1{ color: purple; }
delete <h1purple> and only leave <h1>, in the index tab.