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 trial

CSS How to Make a Website Beginning HTML and CSS Write a CSS Selector and Property

Jessica Van Voorhis
PLUS
Jessica Van Voorhis
Courses Plus Student 6,069 Points

How is this not correct way? The font color is green on the webpage. Not sure why I'm writing CSS in my HTML document.

Don't understand how this isn't correct...?

<body> <style> h1{ color= green; }

</style> <h1>Nick Pettit</h1> </body>

Joshua Kohantab
Joshua Kohantab
6,577 Points

technically the line <h1><font color="green">Nick Pettit</font></h1> is correct . The problem is that's not exactly what this exercise is asking for. It wants you to create a rule inside your style element like this h1{ color:green}.

1 Answer

0yzh 󠀠
0yzh 󠀠
17,276 Points

Hi Jessica, in this case you would not use the font element but instead you want to put the css styles inside the style tag. Also because the h1 is not a class, you would not select it by using the 'dot' h1. Your code should look something like this.

<style> h1{ color: green; }

</style>

Jessica Van Voorhis
Jessica Van Voorhis
Courses Plus Student 6,069 Points

my code still is not working. This is so frustrating, because it's such a simple task and its not working.

0yzh 󠀠
0yzh 󠀠
17,276 Points

The complete code should look like this.

<body>
  <style>
    h1 {
      color: green;
    }
  </style>
  <h1>Nick Pettit</h1>
</body>