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 trialJessica Diaz
618 PointsHow do you change the color of the h1 tag in style.css ?
I am trying the following:
h1 text:{ color: purple; }
<!doctype html>
<html>
<head>
<link href="styles.css" rel="stylesheet">
</head>
<body>
<h1>Welcome to My Web Page!</h1>
</body>
</html>
h1
text:{ color: purple;
}
Jessica Diaz
618 PointsThis helps. Thanks Pamela
1 Answer
doesitmatter
12,885 PointsHi Jessica Diaz,
In css we can select an element in 3 ways.
- By tagname like:
body
,h1
,p
- By ID name like:
#someIdName
- By class name like:
.someName
If you haven't encountered (2) and (3) yet, don't worry, you will in the future.
After we select an element we enter opening and closing braces, everything we want to change to the element we selected will go in there.
h1{
}
Finally we can modify styling properties of this element with key:value
pairs. First we define what want to change (key) then we specify the value we want it to have.
h1{
color: purple;
}
Your code isn't working because you are selecting an element which does not exist within your page. There isn't a h1 text
anywhere in your HTML document.
I hope this helped!
Jessica Diaz
618 PointsThis helps. Thanks
pamela guy
Courses Plus Student 4,311 Pointspamela guy
Courses Plus Student 4,311 Pointsh1 { color: purple; }
Hope this helps!