Is it possible to comment out blocks of code that contain comments in css?

Viewed 306

If I have some css

/* Labeled Section 1 */
.thing1 {}
.thing2 {}

/* Labeled Section 2 */
.thingA {}
.thingB {}

Is it possible to comment both sections out simultaneously? Is there any form of super or sub comment which can be used to make commenting blocks of css which contain comments themselves easier?

EDIT: for those who've never done this before, adding comments around the whole thing doesn't work.

/*  START BIG COMMENT
/* Labeled Section 1  BIG COMMENT ACTUALLY ENDS HERE*/
.thing1 {}
.thing2 {}

/* Labeled Section 2 */
.thingA {}
.thingB {}
END BIG COMMENT */ 
1 Answers

In most languages it is not possible to nest comments - this is also valid for CSS.

What you could do is only the following:

/* Labeled Section 1 */
/*
.thing1 {}
.thing2 {}
*/

/* Labeled Section 2 */
/*
.thingA {}
.thingB {}
*/

Or if you only want to have one comment block:

/*
/* Labeled Section 1 * /
.thing1 {}
.thing2 {}

/* Labeled Section 2 * /
.thingA {}
.thingB {}
*/

So it's important to add a space between all included comments * and /.

Which requires that you remove this extra space when removing the outer comment.

Related