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 trialMUZ140063 Glen T. Moyo
5,257 PointsHow do I make an H1 element green?
I have done the following without success
<style> h1{
color: green;} </style> <h1>Nick Pettit</h1>
<body>
<style>
h1 {}
color: green;
</style>
<h1> Glen Moyo</h1>
<style>
h1 {}
color: green;
</style>
<h1>Nick Pettit</h1>
</body>
1 Answer
Colin Bell
29,679 PointsYour h1 color code isn't between the {} brackets.
You also have two style tags, which isn't necessarily a problem, but you're trying to define h1 twice. Only the second one would be rendered on the page. Though, in this case both times it is being defined as green.
You're trying to add the Glen Moyo h1 tag inside the style tags. Only css styles go between style tags.
Also, it's considered best practice to add the style tag in the header (if you aren't going to use an external stylesheet).
<head>
<style>
h1 {
color: green;
}
h2 {
color: red;
}
</style>
</head>
<body>
<h1>Glen Moyo</h1>
<h2>Nick Pettit</h2>
</body>
MUZ140063 Glen T. Moyo
5,257 PointsMUZ140063 Glen T. Moyo
5,257 PointsThank you for your response. so the to do it, is the way you have done it
Aurelian Spodarec
7,369 PointsAurelian Spodarec
7,369 PointsThis question is common xd .
I sugest that if you have a problem like this , eg for syntax. To go backj on the video on the tab and you can try and look what he did. Because he did the same work as you so you can somehow copy him .
Hope this helps too!
Merry Chrsitmas! soon