Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
215,939 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.