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

HTML How to Make a Website Beginning HTML and CSS Write a CSS Selector and Property

Style Tag Missing

This is the style code I wrote. The challenge tells me I'm missing a style tag. What's wrong with this code?

<style>

 h1 {
      color: blue;
 }

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

When I click on the preview it shows that I've done it correctly. The text turns blue like it's supposed to, but when I check my work it says I'm missing a style tag. The style tag is definitely there. If it wasn't then I would assume that the preview would be incorrect. I've tried the suggestions I received, but it doesn't seem to make a difference. I don't know how to get the challenge to recognize that there is a style tag.

Why don't you post the code you typed in the code challenge to know what is the problem if you can.

4 Answers

You have to write it this way:

<style>
 h1 {
      color: blue;
 }
</style>```

Hope it works with you

As Dustin Scott says, the challenge is to apply style via the <style> </style> tags.

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

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

Dustin Scott and Bryan H are correct. What you have posted above is a CSS rule, not a style tag. The rule needs to be embedded within the style tags.