Jump to content

How to comment out CSS statement with INNER comment?


pstein

Recommended Posts

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?

Link to comment
Share on other sites

There is no way to do it, but if your code editor is syntax highlighted then it should not take longer than a minute to see where all the inner comments are interfering and fix them.

A possible workaround is to wrap the code in a media query which will never be satisfied, like this:

media  (max-width:1px) {

It has the side effect that code minifiers will not remove it in the way they remove comments.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...