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

Write a CSS Selector and Property - Challenge Bug?

Within Beginning HTML and CSS: Write a CSS Selector and Property Challenge task 1 of 3

It asks you to add a <style> element just above the <h1>. I have tried a few variations of this but nothing works such as

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

And it gives me an incorrect error when I go to check my work. Is this some sort of bug?

I would like to get this fixed so I can get credit for this course section, thanks.

index.html
<body>
  <style>
    <h1>Nick Pettit</h1>
  </style>
</body>

3 Answers

Edward Bryan Kene Morales
Edward Bryan Kene Morales
7,374 Points

Hey,

This is not a bug but a syntax error :)

Recall that the basic structure of a web document is

<!doctype html>
<html lang="en">
  <head>

    <!-- meta information here -->

  </head>
  <body>

    <!-- contents of the webpage -->

  </body>
</html>

In your code,

You placed the style tag in the body which is not right because it should be placed in the head tag like this:

  <head>

    <style>

         CSS styles here

    </style>

  </head>

And your H1 tag should be in the body tag:

  <body>

    <h1>Nick Pettit</h1>

  </body>

Just remember that css styles whether it is linked or placed in the head, meta information and javascript should be placed in the head of the document while the content is placed in the body.

Hope this helps!

Sorry I posted the wrong code, here is what I have.

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

It gives me an error when I try to complete that the style tag is missing.

Edward Bryan Kene Morales
Edward Bryan Kene Morales
7,374 Points

That's weird. There's nothing wrong with that code. Can you please post the whole question if you can.

Saad Anjum
Saad Anjum
6,408 Points

Hi,

From your subject, the challenge states "Write a CSS Selector and Property" ... I would assume that inside the style tag you need to use css to select the h1 element and write any css style property for it.

Something like this:

<head>
  <style>
    h1 {
      color : blue;
    }
  </style>
</head>
<body>
    <h1>Nick Pettit</h1>
</body>