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 trialDaniel Brown
240 PointsBasic HTML CSS helpChange color of h1 tag to purple.
hi friends! I need help with changing the color of a text in h1.
<!doctype html>
<html>
<head>
<link href="styles.css" rel="stylesheet">
</head>
<body>
<h1>Welcome to My Web Page!</h1
>
</body>
</html>
Jacob Mishkin
23,118 PointsIt's extremely important to see what your answer is, as we can use this as a bench mark to guide you to the correct answer. Before I can help I need to see what you have come up with, even if it's totally wrong, it doesn't matter. By seeing your answer we can see your thought process, and that is more important than syntax. We want to help, but we need to see what you come up with as well.
2 Answers
Kieran Corcoran
11,188 PointsYou will need to target the h1 from your style sheet.
h1 { color: red; }
Kieran Corcoran
11,188 PointsYou may find this link helpful to practice: https://www.w3schools.com/cssref/tryit.asp?filename=trycss_sel_element_comma
Stanley Brooks
19,197 PointsStanley Brooks
19,197 Pointsbe sure to watch your syntax, your closing h1 should look like this: </h1>
***also, there are many ways to do this depending on what you are hoping to accomplish. The easiest way would make a CSS rule for the h1 selector.
h1 { color: purple; }
***this way will make all of your h1's purple, so you may want to give the specific h1 header you are looking to manipulate an ID and write a new rule for it.
html (line 8):
<h1 ID="purple-title">Welcome to My Web Page!<h1>
CSS:
purple-tilte {
color: purple; }
***for a basic layout like this one it really wont matter, but the more specific you are, the easier it will be to change later.