css注释

CSS gives you the ability to write comments in a CSS file, or in the style tag in the page header

CSS使您能够在CSS文件或页面标题中的style标签中编写注释

The format is the /* this is a comment */ C-style (or JavaScript-style, if you prefer) comments.

格式是/* this is a comment */ C样式(或JavaScript样式,如果您愿意的话)注释。

This is a multiline comment. Until you add the closing */ token, the all the lines found after the opening one are commented.

这是多行注释。 在添加结束标记*/ ,将对在开始标记之后找到的所有行进行注释。

Example:

例:

#name { display: block; } /* Nice rule! *//* #name { display: block; } */#name {display: block; /*color: red;*/
}

CSS does not have inline comments, like // in C or JavaScript.

CSS没有内联注释,例如C或JavaScript中的//

Pay attention though - if you add // before a rule, the rule will not be applied, looking like the comment worked. In reality, CSS detected a syntax error and due to how it works it ignored the line with the error, and went straight to the next line.

不过请注意-如果在规则之前添加// ,则该规则将不会应用,就像注释起作用一样。 实际上,CSS检测到语法错误,由于它的工作方式,它忽略了出现错误的行,并直接进入下一行。

Knowing this approach lets you purposefully write inline comments, although you have to be careful because you can’t add random text like you can in a block comment.

知道这种方法后,您可以有目的地编写内联注释,尽管您必须小心,因为您不能像在块注释中那样添加随机文本。

For example:

例如:

// Nice rule!
#name { display: block; }

In this case, due to how CSS works, the #name rule is actually commented out. You can find more details here if you find this interesting. To avoid shooting yourself in the foot, just avoid using inline comments and rely on block comments.

在这种情况下,由于CSS的工作方式,实际上会注释掉#name规则。 如果您对此感兴趣,可以在这里找到更多详细信息。 为了避免脚步被枪杀,只需避免使用内联注释并依靠块注释。

翻译自: https://flaviocopes.com/css-comments/

css注释

css注释_CSS注释相关推荐

  1. css注释_CSS注释示例–如何注释CSS

    css注释 Comments are used in CSS to explain a block of code or to make temporary changes during develo ...

  2. css 注释_CSS注释教程

    css 注释 Comments are an important part of programming and scripting. CSS or Cascade Style Sheet also ...

  3. js mysql java_Java、mysql、html、css、js 注释大小写

    MySQL服务器支持3种注释风格: ·         从'#'字符从行尾. ·         从'-- '序列到行尾.请注意'-- '(双破折号)注释风格要求第2个破折号后面至少跟一个空格符(例如 ...

  4. python 为html页面增加背景_Python 给html css自动添加注释

    Python 给html css自动添加注释(2020年11月8日) 背景 大二上学期专业开设了网页设计课程,专门学习html和css,有时候也经常有同学找我来帮忙看看他们写的代码,并且改改,我就忽然 ...

  5. 属于HTML注释,html注释与css注释的区别是什么?

    注释就是不被程序执行的代码.用于程序员标记代码,在后期的修改,以及他人的学习时有所帮助,在开发网站或者功能模块开发时,代码的注释尤其重要. HTML注释与css注释的区别:HTML注释语法为:用于HT ...

  6. html css js注释区别,html、css和js注释的规范用法

    成为专业的前端工程师!!! html注释: css注释: //注释内容 单行注释(不推荐使用,因为有的浏览器可能不兼容,没有效果) /*注释内容*/ 多行注释(推荐使用) JavaScript: // ...

  7. 注释嵌套注释_注释,无处不在的注释

    注释嵌套注释 十年前的2004年 , Java 1.5开始提供注释. 很难想象没有此功能的代码. 实际上,首先引入了注释,以减轻开发人员编写繁琐的样板代码的痛苦,并使代码更具可读性. 考虑一下J2EE ...

  8. javascript注释_JavaScript注释

    javascript注释 As with HTML & CSS, it is good practice to comment your code: not only for yourself ...

  9. 注释嵌套注释_DIY注释

    注释嵌套注释 从Java 5开始,Java中出现了注释. 我想做一个自己的注释,只是为了看看需要什么. 但是,我发现它们只是接口. 有擦 接口后面没有牙. 必须执行一些代码. 我认为这是橡胶行之有效的 ...

最新文章

  1. centos7下别名(alias)的特殊用法
  2. python - HTMLTestRunner 测试报告模板设置
  3. Java语言中的----数组
  4. 童话 计算机教程,数学绘本 | 脑袋里装了个计算器(第四讲)
  5. java json插件安装_IDEAL葵花宝典:java代码开发规范插件:GsonFormat插件将JSONObject格式的String 解析成实体...
  6. 【软件测试】白盒测试的条件覆盖标准强于判定覆盖(错)
  7. CodeForces 622A--F - Infinite Sequence
  8. 在php页面出现乱码的原因,html网页乱码原因与解决方法
  9. 白话区块链 之4: 区块链分类与架构
  10. ArcGis拓扑——规则、概念与要点
  11. android的事件处理和传递机制实例
  12. 活着,要有温暖的感觉
  13. Postman 批量执行请求
  14. MFC(CFile)文件操作
  15. 第6章 IT服务运营管理
  16. mysql创建单表只读访问用户及过程问题处理:如mysql: command not found ///GRANT command denied to user
  17. pytorch应用于MNIST手写字体识别
  18. 分享某盘不限速神器,免费好用
  19. okhttp下载保存图片并更新图库
  20. Why T - 为什么玩微博?

热门文章

  1. python在线运行调试-Python调试工具
  2. 不同进制之间的转换[全网最全!!!]
  3. 今天是2011年5月26日
  4. 【在线研讨-现场文字】《敏捷开发用户故事分类与组织结构(一期-5)》2012-06-26...
  5. 【新书速递】程序员必会的40种算法
  6. 联想 Lenovo System x3650 M5 服务器开启超线程功能 Hyper-Threading
  7. 什么是软件和软件架构
  8. 纵横网络靶场社区-wp
  9. 新车上了牌还不算完,这些物品车上必备,关键时可救命!
  10. VC++中利用/GS开关防止缓冲区溢出