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

I don't understand how to select the h1 code? For this challenge I type <style></style> h1 { }

is this the right code i'm supposed to enter?

index.html
<body>
  <style>
  h1 {

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

4 Answers

Stone Preston
Stone Preston
42,016 Points

your CSS selector is correct, however you have your h1 html tag inside the style tag. it does not need to be in there. close the style tag before the h1 tag starts. style tags are meant to contain css code, not html

<body>
  <style>
    h1 {

    }

    </style>

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

There are a few issues with the code you provided. First off the style tag should be in the head and not in your body like you've provided. Your element level 1 heading then should be in the body... see my example below:

<html>

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

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

</html>
Stone Preston
Stone Preston
42,016 Points

First off the style tag should be in the head and not in your body like you've provided.

thats actually not what the task wants (although it is more idiomatically correct). the task explicitly states: We're starting out with an h1 element and a body element. Add a style element just above the h1.

so the style tags need to go directly above the h1 tag

<body>
  <style>
    h1 {

    }

    </style>

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

you wont pass if you put the style tags inside the head

Hi Haley,

First, you must understand to separate HTML codes to CSS codes. Secondly, practice external stylesheet because that is the highly recommended.

Hope this helps.

Hi Haley,

First, you must understand to separate HTML codes to CSS codes. Secondly, practice external stylesheet because that is the highly recommended.

Hope this helps.