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 trialrobertanderson4
209 PointsI'm having a hard time getting the h1 element to green
This is what I have, but I'm not sure how to fix it
<body> <style> h1 { color:green; }
<style> <h1>Nick Pettit</h1> </body>
4 Answers
Jeff Busch
19,287 PointsHi Robert,
I copied and pasted your code into the code challenge and it worked. Be sure you are leaving the style element tags in place from the previous challenge.
Jeff
<style>
h1 { color:green; }
</style>
/* Or better yet: */
<style>
h1 {
color:green;
}
</style>
Ruben Leija
4,051 PointsI am not sure how your html code looks like. But theirs a couple things I can think of that could be causing the problem.
- Your CSS is not linked to your html page
- You dont have a h1 tag element on your html page
Hasan Pektas
2,128 PointsI think the problem is that it overlaps with another style for the h1 you're trying to change the color to. Try to specify a class like:
h1.class-name {
color: green;
}
And then in the h1-tag <h1 class="class-name">Hello</h1>
. If that works then the problem is that it you have already specified the color somewhere else in the CSS.
robertanderson4
209 PointsThanks for the help everyone. I'm very new to this, so I appreciate the advice. I'll give it another shot at this challenge when I get home from my day job later tonight.
James Barnett
39,199 PointsJames Barnett
39,199 PointsJeff Busch -
>
Or better yetI would beg to differ, CSS rules that have only one property should be on 1 line for maximum readability.
However, that's neither here nor there for Robert Anderson whose trying to right his first rule CSS.