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

Im not really sure why it is saying that I'm not enclosing the <style> tag

When I write the code <style> the closing </style> tag doesn't pop up and I don't know why. I hope this question makes sense, I have zero experience when it comes to writing code.

index.html
<body>
  <style>
    h1{
      color:blue;
    }
    <h1>Nick Pettit</h1>
    </style>
</body>

3 Answers

rydavim
rydavim
18,814 Points

Style tags are used to add CSS into your HTML document. Make sure you're not wrapping any HTML elements inside your style tags. In this case, you need to close your style tag before the h1 element.

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

Hey,

You just need to wrap the style tag around the styling, not the element that you're trying to style.

<style>
   h1 {  some styling }
</style>
<h1>Nick</h1>

hope this helps.

Krishnendu Banerjee
Krishnendu Banerjee
1,005 Points

put the whole of the syle tag portion above the h1 elementbut inside the body tag