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 Treehouse Club: HTML Publish a Story Write a comment in HTML

Mariya Betina
PLUS
Mariya Betina
Courses Plus Student 2,026 Points

if I add comments after <style> tag it stopes to use h1 style rule... why is it so?

e.g. <style>

<!--This part is to make my text brighter.-->

h1 {text-align: center; color: purple } h2 {text-align: center; color: coral} h3 {text-align: center; color: brown} h4 {text-align: center; color: blue} </style>

but ir correctly uses all other prescriptions. in case I delete the comment, h1 will be used.

Celeste Hebert
Celeste Hebert
9,904 Points

Can you post an example?

Is it possible that you're forgetting to close the comment tag? A proper comment should look like this:

/* Comment */

3 Answers

Steven Parker
Steven Parker
231,072 Points

You didn't share any code, but I'd guess you may have used the wrong type of comment.

:point_right: Within the style area, you need to use CSS-style comments.

<!-- this is an HTML-style comment (use when outside the style area) -->
<style> /* this is a CSS-style comment (use this kind inside the style area) */
</style>
Mariya Betina
PLUS
Mariya Betina
Courses Plus Student 2,026 Points

I've tried /* Comment */ to pick out the comments and it works fine now.

thank you so much for your answer)) but previously I've tried <!-- comment--> signs as it was in the video... may be there are some difference between comments at the very beggining of the code and in the style part.

Mariya Betina
PLUS
Mariya Betina
Courses Plus Student 2,026 Points

many thanks for you, guys. that was really this mistake. I used wrong type of comments.