Is there a good reason for this? Lame question, but I just wondered if there was a reason why.
Because the CSS language is defined so.
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
{ }
;
#
Different languages have different specifications with different functionality. In another language you may have comments that start with # instead of //.
See the specification.
4.1.9 Comments
Comments begin with the characters
/*
and end with the characters*/
. They may occur anywhere between tokens, and their contents have no influence on the rendering. Comments may not be nested.CSS also allows the SGML comment delimiters (
<!--
and-->
) in certain places defined by the grammar, but they do not delimit CSS comments. They are permitted so that style rules appearing in an HTML source document (in the STYLE element) may be hidden from pre-HTML 3.2 user agents. See the HTML 4 specification ([HTML4]) for more information.
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.
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.
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 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.