What are css comments

藏色散人
Release: 2023-01-04 09:34:04
Original
9005 people have browsed it

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.

What are css comments

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:

/* 注解注释内容 */
Copy after login

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;
}
/* ----------文字样式结束---------- */
Copy after login

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!

Related labels:
css
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!