css comments start with "slash asterisk (/*)" and end with "asterisk slash (*/)"; css comment characters are all English half-width lowercase, and the "*" symbol Do not place them directly next to the comment content. At least one space must be left empty.
The operating environment of this article: Windows 7 system, HTML5&&CSS3 version, DELL G3 computer
Comments are preceded by "slash asterisk (/*)" Start with "asterisk slash (*/)" and end with the annotation content in the middle of "/*" and "*/". It should be noted that the comment characters are all English half-width lowercase; and the "*" symbol should not be placed next to the comment content, and at least one space must be left empty.
Basic syntax of CSS comments:
/* 注解注释内容 */
Example:
If we write a piece of CSS code, in order for others to see clearly what it means, what part of the code is CSS style selector, we can add CSS comments in CSS.
/* ----------文字样式开始---------- */ /* 白色12象素文字 */ .dreamduwhite12px { color:white; font-size:12px; } /* W3Cschool黑色16象素文字 */ .dreamdublack16px { color:black; font-size:16px; } /* ----------文字样式结束---------- */
If we encounter a place that needs special explanation when writing CSS, we can use CSS annotations to annotate. Comments are helpful for others to read and understand the developed CSS code. Proper use of comments and as few comments as possible are beneficial to compatibility and file size reduction.
The annotated CSS code style does not take effect (does not work). The annotated code or content is not reflected in the browser. It only has the function of prompting comments when viewing the CSS code.
Recommended learning: "css video tutorial"
The above is the detailed content of What are css comments. For more information, please follow other related articles on the PHP Chinese website!