1

In css, I can do comments like this

/* test */
p {
    color: red;
}
/* test2 */
h1 {
    color: red;
}
/* test3 */
h2 {
    color: red;
}

but now what if I wanted to comment test2 and test3. This doesn't work.

/* test */
p {
    color: red;
}
/*
    /* test2 */
    h1 {
        color: red;
    }
    /* test3 */
    h2 {
        color: red;
    }
*/

Does anyone know how to do it?

Thanks.

omega
  • 40,311
  • 81
  • 251
  • 474

3 Answers3

0
/* test3 */

should be only

/* test3

to keep it open until the last */

dhh
  • 4,289
  • 8
  • 42
  • 59
Frank Escobar
  • 368
  • 4
  • 20
  • But then if I didn't do the outer comment wrapping, the opening comment of test3 makes the rest of the css commented. I'm looking to nest comments. – omega Jun 18 '15 at 16:42
  • If you wanna comment that test3/h2 block it should be like this: /* test */ p { color: red; } /* /* test2 */ h1 { color: red; } /* test3 h2 { color: red; } */ – Frank Escobar Jun 18 '15 at 16:44
0

To comment multiple lines in CSS, just don't close your

/*

You can have something like that :

/* test 
p {
color: red;
}
 test2
h1 {
color: red;
}
*/

/* test3 */
h2 {
color: red;
}
Thibaud Lacan
  • 346
  • 1
  • 6
  • 13
-1

Just coment all what u dont need

/*
line1
Line2
line3
 */
 Line 4
line5
/*again*/
  • Thats not what I am asking. I am asking how to nest comments in other comments. – omega Jun 18 '15 at 16:43
  • /* test */ p { color: red; } /*------------comment start /* test2 */---- comment end h1 { color: red; } /* test3 */ h2 { color: red; } */ thats why not working u must remove end comments – Aleksandar Milisavljevic Jun 18 '15 at 16:46