How to comment out CSS statement with INNER comment?

Viewed 86

Assume I have in an *.css file a CSS statement similar to the following:

blahbla {  font-size: 20px !important;
           line-height: 20px !important;   /* added in August 2021 */
           font-family: Verdana !important; }

As you can see it contains a comment

Now I want to comment out the whole CSS statement (without removing the inner comment!).

The following does not work:

/*
blahbla {  font-size: 20px !important;
           line-height: 20px !important;   /* added in August 2021 */
           font-family: Verdana !important; }
*/

....since the closing comment tag of the inner comment closes the outer comment as well.

How else can I comment out a CSS statement ignoring possible inner comments?

2 Answers

Sadly you can't.

The only comment type for css is /* */. (You have to open and close the comment). (Source: https://www.w3schools.com/css/css_comments.asp)

If you consider switching to sass you can use single-line comments // and multiline comments /* */. But then you have to compile your sass code into css, because browsers can't interpret the scss syntax.

You can't do that.

My best advice would be to start a new line of comment after each inner comment

/*
blahbla {  font-size: 20px !important;
           line-height: 20px !important;   /* added in August 2021 */
/*
           font-family: Verdana !important; }
*/
Related