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

code challenge says I forgot to add style tag

This is my code:

<style>

    h1 {
        color: blue;
    }

</style>
<h1>Renee</h1>

It looks just like what I typed in the file while following along with the video, but when I check it, it keeps saying "don't forget to add your style tag" Is there a glitch, or am I actually missing something?

I'm also now not sour if I'm doing something incorrect in the discussion, but it is not displaying all of the code. It's showing the CSS part, not the HTML, but the text of the HTML is here when I edit the post.

Hi Renee,

The forums will strip out html tags if you don't post them correctly.

This should help you out: https://teamtreehouse.com/forum/posting-code-to-the-forum

Ah, thanks. I'll take a look. Any suggestions on my issue???

22 Answers

you should look at this question seems it's the same issue you're having.

https://teamtreehouse.com/forum/adding-the-style-tag

Santiago Posada
Santiago Posada
5,189 Points

this is what I tried and worked for me give it a shot

< body>

  < style></ style>

    < h1>Nick Pettit</ h1>

</ body>

I add some spaces so it will show my answer, get rid of them so it works

looks like the style tag should go before the h1 part

Marston Gould
seal-mask
.a{fill-rule:evenodd;}techdegree
Marston Gould
PHP Development Techdegree Student 17,314 Points

I found on a few instances that once an answer was rejected, it would not be accepted , even if corrected. I had to stop the exercise, go back to the end of the previous video and have it reinitiate the exercise.

I also found that you should not delete comments that say put code below them.

You can also copy your code and place in validator.w3.org

Hope that helps

Nick Pettit
Nick Pettit
Treehouse Teacher

Hi Marston Gould,

That's strange, you shouldn't need to reinitialize the challenge. I'm copying one of our developers so he can take a look. /cc Kyle Meyer.

Thanks!!

Santiago Posada
Santiago Posada
5,189 Points

why dont you try this

<style>
     h1 { color: (the one you want);
}
< /style>

Thats the style tag

Hope this helps

is not showing my complete answer

before the h1 try < style> and after the whole thing close the tag with < /style>

i need to go back to sleep...

<style type="text/css"> .... your style info </style>

this is probably what it means.

Oh...the video didn't mention the type="text/css" part. I'll try that, thanks

Really? I've not taken the HTML track as I've been doing HTML for 20 years, seems kind of pointless. I am surprised that they didn't mention the "type" attribute.

I just tried it with your suggestion in there, didn't help.

thanks!!

well..that person has the same issue, the answer doesn't seem to be applicable. I'll come back a bit later this evening

Thank you, Santiago, but that is what I have up there.

Santiago Posada
Santiago Posada
5,189 Points

No, is not the same for some reason is not showing the style tag I was adding, you supposed to add < style> before and </ style> after the h1 part I mean the stuff you have place it between <style> ones opening and close ones

Santiago, it does not display the <style> here for some reason, but it very definitely is in the box when I'm checking my work.

Santiago, please believe me, I already have it there when I check my work.I don't know why it doesn't display here, but it is THERE

Santiago Posada
Santiago Posada
5,189 Points

I just did it and this is it:

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

</body>

that will work I just did it

Hi Santiago,

Please check the link I posted as a comment at the top. Then you won't have to go through the trouble of putting in spaces throughout your tags.

That is the worse idea ever. Style tag NEVER goes in the body tag. It always goes in the <HEAD></HEAD> tag.

James,

It's really just for the code challenge here. This isn't how the website project is taught.

The style element can go in the body section so I wouldn't say NEVER. It does need a scoped attribute to be valid though.

This would be valid code that will pass the w3c validator:

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

</body>

While I agree it CAN go in the BODY, it never should. Scoping can be done with classes and IDs never ever should be be in the body. It's considered a bad practice.

Santiago Posada
Santiago Posada
5,189 Points

for question one is just add the style tag before the h1 stuff for the second is creata a h1 {} between the style tag then just use the one I gave you before, I just did it and it show my work was good, so Im sure about this one

Santiago, this is extremely frustrating. You have told me to put the same thing in there four times now. I have just copied and pasted the code in your last response just in case there was something in yours that worked for you that I am missing.It still gives me the same response, I have tried it in two different browsers and on another computer.

I understand that you are trying to help, but please do not tell me to do the same thing yet again.

Santiago Posada
Santiago Posada
5,189 Points

well I did it and it worked for me too bad for you didnt good luck then, but thats the answer

Santiago Posada
Santiago Posada
5,189 Points

thanks for the posting trick Jason, is way better than using spaces! and I want to know if the code worked with blue, cuz I try it and didnt.

So that might be it

You're welcome. I can see in this question: https://teamtreehouse.com/forum/image-tag-4 that you're a code posting expert now :)

Nick Pettit
STAFF
Nick Pettit
Treehouse Teacher

Hi Renee Rhodes,

Were you able to figure this out? If not, did you include the body element in your answer? I'm asking just because I didn't see it in your original post.

Thanks, Nick! Yeah I did in the actual piece. It finally accepted it after I tried a bunch of times.

I got it, didn't change anything from what I had, it just seems to have decided to work, I dunno. Thanks, folks

Hi Renee,

Did it actually pass with color: blue? I think the challenge requested green, just curious.

Anyways, I know that some other people on the forums have been having trouble with correct code not getting through. i don't know why but you can always try refreshing the page when you're pretty sure you're right and start over.

I started with blue and the next step was to turn it green.