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

Coloring h1

On how to make a website I'm getting an error that says, "Bummer! Make sure you're coloring the h1 tag green." Not sure why, can you help?

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

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

1 Answer

Jeff Lemay
Jeff Lemay
14,268 Points

The styling you added is off in a few places. Let's try to clean it up:

<style>
     {h1
     color; green:/}

  </style>

So, whenever you write css, you start with a selector. In this case, h1. After selecting the element you want to add styling to, you add styles within curly braces {}.

<style>
    h1 {

    }
</style>

Then, you add properties inside the curly braces to declare the individual styling to add: "color" for font color, "background-color" for background color, "text-align", "padding", "font-weight", etc..

For each property, you start with the property's name (in this case "color"), then a colon, then your value for the property (in this case "green"), then you close the property with a semi-colon.

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

And that's how basic css styling works!

I figured it out thanks for the help.