注释规范


Comments begin with the characters /* and end with the characters */. They may occur anywhere outside other tokens, and their contents have no influence on the rendering. Comments may not be nested.

  • 注释以字符 /* 开始,以字符 */ 结束
  • 注释不能嵌套
  1. /*Comment Text*/

团队约定

单行注释

注释内容第一个字符和最后一个字符都是一个空格字符,单独占一行,行与行之间相隔一行

推荐:

  1. /* Comment Text */
  2. .jdc{}
  3. /* Comment Text */
  4. .jdc{}

不推荐:

  1. /*Comment Text*/
  2. .jdc{
  3. display: block;
  4. }
  5. .jdc{
  6. display: block;/*Comment Text*/
  7. }

模块注释

注释内容第一个字符和最后一个字符都是一个空格字符,/* 与 模块信息描述占一行,多个横线分隔符-*/占一行,行与行之间相隔两行

推荐:

  1. /* #region A */
  2. .mod_a {}
  3. /* #regionend A */
  4. /* #region B */
  5. .mod_b {}
  6. /* #regionend B */

不推荐:

  1. /* #region A */
  2. .mod_a {}
  3. /* #regionend A */
  4. /* #region B */
  5. .mod_b {}
  6. /* #regionend B */

更多关于CSS注释:#Comments