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

CSS Treehouse Club: CSS My First Web Page Introduction to My First Web Page

Andy Dodds
Andy Dodds
1,986 Points

Should 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

Are you adding single line comments // or multiple line comments /**/ ?

Andy Dodds
Andy Dodds
1,986 Points

Just 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
Julian Aramburu
11,368 Points

Andy 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
Andy Dodds
1,986 Points

Ah, thanks for pointing this out guys. Knew it would be something like that. Very much appreciated!

Andy

Seth Kroger
Seth Kroger
56,413 Points

HTML 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
Andy Dodds
1,986 Points

Thanks Seth! Appreciate all the quick feedback.

Julian Aramburu
Julian Aramburu
11,368 Points

Hi 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
Andy Dodds
1,986 Points

Thanks 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