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

How do I make an H1 element green?

I have done the following without success

<style> h1{

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

index.html
<body>
  <style>
    h1 {}

      color: green;
    </style>
  <h1> Glen Moyo</h1>
  <style>
    h1 {}

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

1 Answer

Colin Bell
Colin Bell
29,679 Points

Your 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).

index.html
<head>
  <style>
    h1 {
      color: green;
    }

    h2 {
      color: red;
    }
  </style>
</head>

<body>
   <h1>Glen Moyo</h1>
   <h2>Nick Pettit</h2>
</body>

Thank you for your response. so the to do it, is the way you have done it

This 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 :smiley: