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

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

how do i change the color of the h1 element to green?

not sure if am just failing to understand what h1 element is but am trying to change the color the way have done the firsts ones and its not working.

index.html
<h1>style</h1>
<style>

  h1 {
    color: blue: 
  }

  <style>

  h1 {
    color: blue: 
  }

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

1 Answer

Michael Lauridsen
Michael Lauridsen
10,321 Points

Hi Paul,

The problem seems that you opened the <style> tag twice, but only closed it once. Also, when you end a CSS selector, you should use a semicolon instead. I can also see that you targeted the h1 twice, luckily with CSS this does not matter, since it's cascading, the last selector will overwrite the first one.

As a side note, generally you want to put your style tags or stylesheets in top of the document. This is to prevent the html content from loading before it is styled. The reason is that the user would see a short glimpse of the unstyled html in some cases.

If you want to turn the h1 element green as in the challenge, this should do it:

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