Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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>