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 trialTIEN PHAM
429 Pointshow do I set the color of the h1 element to green
i did exactly as the video but the result is wrong
<h1>
<style>
h1 {}
color: blue;
Nick Pettit</h1>
h1 {
2 Answers
Jonathan Grieve
Treehouse Moderator 91,253 PointsUnfortunately it's not quite right.
Inside the style element you need to write a CSS style rule to select the h1 element and change its colour.
The basic structure of a CSS style rule is as follows
selector {
property: value
}
So there are 3 main parts. The element you want to target (the selector), the property and its value.
So to change the colour of the h1 element you'd do.
h1 {
color: green;
}
Good luck.
Peaches Stubbs
21,320 PointsWhat Jonathan said is correct. The only thing that I would add is if you do it that way all h1 elements on the page will be green. What I usually do is create a class, then attach that class to the elements that I want to have those particular features.
priyanka dash
5,340 Pointspriyanka dash
5,340 PointsThe way you have written is not correct.you must seprate the style from tag.You can put style with tag like inline style that is
<h1 style="color:blue;">Nick Pettit </h1> or Inside <head> <style> h1 { color:blue; } </style> </head> OR you can write a separate css file and link it inside head tag. <link rel="stylesheet" type="text/css" href="mystyle.css">