This forum is now read-only. Please use our new forums at discuss.codecademy.com.

CSS: An Overview Forum

View Course » View Exercise

715 points
745e3a3d6ab708080fa91f7118ac52ae?s=140&d=retro
Submitted by
lmntz4
about 2 years ago

CSS comments

After reading a few other forum questions regarding this particular exercise, I think I need clarification regarding CSS comments, their purpose, and how to enter them in the CSS file. It seems as though the closing */ can come after the closing }. However, for this exercise, if you follow the instructions exactly, and enter the */ after the closing }, the text formatting does not apply. I realize the text states "I'm currently red, but I'm about to become black!" and this does occur when the instructions are followed exactly, but I have a few questions:

  1. Why is the goal to change the text to black when the CSS file appears to be written to change the text to red?
  2. I thought comments don't actually affect any change, but if you do enter the comment in the exact manner stated in the Instructions, the text does change to black. Why?
  3. What is the actual purpose of this specific exercise?

0 votes

permalink

if you follow the instructions you should have this in your exercise (css):

/*p {
    color:red;
}*/

the purpose of this exercise is simple, it will show you you can comment out specific bits of codes, can be useful for:
finding a mistake (forgetting semicolon), by making comments
if you wrote code, i think: wait, i need that later, not yet actually, so you comment it out, rather then deleting and retyping.

it is good to know you can comment out an entire css selector (like in this exercise) or just one property:

p {
    color:red;
    /*font-size: 20px; */
}

trust me, the more you do css, you will discover that comment out certain pieces of css is very useful, this exercises teaches you how to

2410 points
5671826195e378c47d000782_659060817
Submitted by
stetim94
about 2 years ago