Why double Slash comments are not working in CSS files?

Is there any reason why double slash ( // ) comments are not working in CSS files?

Lets take the following:

button
{
    // This is a comment which does not work
    /* This is a comment which works */
}

I am asking because in GTKInspector the double slash comments are working fine.

Because that’s how comments work in CSS: https://developer.mozilla.org/en-US/docs/Web/CSS/Comments

1 Like

You did not understand my Question or I did not put it right ( sorry about that ).
Why one can use // in Gtkinspector but not in a CSS file.

Why one can use // in Gtkinspector but not in a CSS file.

One can’t in the GTK inspector either, at best it’s slightly more tolerant and does not fail the whole parsing, but it doesn’t actually work:

label {
color: red;
// not a comment
border: 1px solid red;
background: blue;
}

What I get is red color and blue background for labels, but no red borders. If you remove the “comment” line (which is not actually one), the border starts working because it’s not seen as a buggy declaration anymore.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.