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 trialRenee Rhodes
10,653 Pointscode 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.
Renee Rhodes
10,653 PointsAh, thanks. I'll take a look. Any suggestions on my issue???
22 Answers
James Andrews
7,245 Pointsyou should look at this question seems it's the same issue you're having.
Santiago Posada
5,189 Pointsthis 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
PHP Development Techdegree Student 17,314 PointsI 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
Treehouse TeacherHi 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.
Renee Rhodes
10,653 PointsThanks!!
Santiago Posada
5,189 Pointswhy 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>
James Andrews
7,245 Pointsi need to go back to sleep...
James Andrews
7,245 Points<style type="text/css"> .... your style info </style>
this is probably what it means.
Renee Rhodes
10,653 PointsOh...the video didn't mention the type="text/css" part. I'll try that, thanks
James Andrews
7,245 PointsReally? 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.
Renee Rhodes
10,653 PointsI just tried it with your suggestion in there, didn't help.
Renee Rhodes
10,653 Pointsthanks!!
Renee Rhodes
10,653 Pointswell..that person has the same issue, the answer doesn't seem to be applicable. I'll come back a bit later this evening
Renee Rhodes
10,653 PointsThank you, Santiago, but that is what I have up there.
Santiago Posada
5,189 PointsNo, 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
Renee Rhodes
10,653 PointsSantiago, it does not display the <style> here for some reason, but it very definitely is in the box when I'm checking my work.
Renee Rhodes
10,653 PointsSantiago, 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
5,189 PointsI 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
Jason Anello
Courses Plus Student 94,610 PointsHi 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.
James Andrews
7,245 PointsThat is the worse idea ever. Style tag NEVER goes in the body tag. It always goes in the <HEAD></HEAD>
tag.
Jason Anello
Courses Plus Student 94,610 PointsJames,
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>
James Andrews
7,245 PointsWhile 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
5,189 Pointsfor 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
Renee Rhodes
10,653 PointsSantiago, 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
5,189 Pointswell I did it and it worked for me too bad for you didnt good luck then, but thats the answer
Santiago Posada
5,189 Pointsthanks 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
Jason Anello
Courses Plus Student 94,610 PointsYou'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
Treehouse TeacherHi 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.
Renee Rhodes
10,653 PointsThanks, Nick! Yeah I did in the actual piece. It finally accepted it after I tried a bunch of times.
Renee Rhodes
10,653 PointsI got it, didn't change anything from what I had, it just seems to have decided to work, I dunno. Thanks, folks
Jason Anello
Courses Plus Student 94,610 PointsHi 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.
Renee Rhodes
10,653 PointsI started with blue and the next step was to turn it green.
Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 PointsHi 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