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 trialAndy Dodds
1,986 PointsShould adding comments in my style.css alters the appearance of my webpage?
I added comments in my style.css file to note the updates I made to the top bar, but after saving and previewing my page I noticed the appearance of the page changed. Alignment, colors, and fonts were altered, even though I didn't touch those parts of the code.
If I remove my comment, re-save, and again preview my page, it reverts to the normal display. Should I not be entering comments in the style.css file?
Any help is greatly appreciated!
Andy
Andy Dodds
1,986 PointsJust a single line comment! Here's the example I shared with Julian, also:
```html { border-top: 50px solid #2A85A5; }
<!--altered width and color-->```
Andy
3 Answers
Julian Aramburu
11,368 PointsAndy those comments tags are for html only... if you want to write comments in the css files you must use as Leyton Parked pointed out the next syntax:
//this is a single line comment
/* this is a multiple line
comment */
Andy Dodds
1,986 PointsAh, thanks for pointing this out guys. Knew it would be something like that. Very much appreciated!
Andy
Seth Kroger
56,413 PointsHTML and CSS have each different formats for comments. HTML and XML use the <-- Comment goes here --> way, but CSS uses the slash-asterisk to mark comments like this: /* Comment goes here */
Andy Dodds
1,986 PointsThanks Seth! Appreciate all the quick feedback.
Julian Aramburu
11,368 PointsHi Andy! Comments should not modified your code since they are just comments and are not "translated" into what you end viewing in your browser... so you could have some syntax problem in your comments maybe?
Andy Dodds
1,986 PointsThanks for the quick reply...I thought so too, but the syntax should be sound. Here's a snippet:
```html { border-top: 50px solid #2A85A5; }
<!--altered width and color-->```
Am I missing something?
Andy
Leyton Parker
6,556 PointsLeyton Parker
6,556 PointsAre you adding single line comments // or multiple line comments /**/ ?