Why do /**/ comments work in stylesheets but // comments don't?

后端 未结 6 1427
死守一世寂寞
死守一世寂寞 2020-12-16 10:49

Is there a good reason for this? Lame question, but I just wondered if there was a reason why.

6条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-16 11:48

    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.

提交回复
热议问题