Is there a good reason for this? Lame question, but I just wondered if there was a reason why.
相关问题
- Adding a timeout to a render function in ReactJS
-
Why does the box-shadow property not apply to a
- Add animation to jQuery function Interval
- jQuery hover to slide?
- Issue with star rating css
If you want this style of comment (and a variety of other useful features that should have been in the CSS specification), try using a LESS CSS.
Because the CSS language is defined so.
Different languages have different specifications with different functionality. In another language you may have comments that start with # instead of //.
See the specification.
Note: There is no mention of comments that begin with 2 slashes and end at the line break. So that's why it's not supported.
The syntax for comments in CSS is:
/* comment here */
The
//
is not a valid syntax. I guess this allows CSS to work correctly when stripped from whitespace and new line characters during minification.Because
/* */
is the style that is defined for comments in CSS.There are a lot of other ways to write comments in other environments that doesn't work in CSS, like:
//
<!-- -->
--
'
REM
{ }
;
#
Because the specification allows for /**/ but not // :)
Seriously, though, CSS treats newlines like all other whitespace, and would not be able to determine the end of the comment without a terminating delimiter.