Home  >  Article  >  Web Front-end  >  What is the css comment method?

What is the css comment method?

青灯夜游
青灯夜游Original
2021-07-05 14:55:224770browse

In css, you can use the "/*" and "*/" symbols to comment, starting with "/*" and ending with "*/", with the content that needs to be commented in the middle, and the syntax format is "/ *Comment content*/”; comment characters are all English half-width lowercase.

What is the css comment method?

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

HTML comments and CSS comments are often used in DIV CSS web pages, and most of the various comments are used to add comments to important code to indicate the meaning.

The syntax of css comments:

/* 注释内容 */

CSS comments start with a "/*" slash and an asterisk, and end with a "*/" asterisk and slash. The annotation description content is placed between "/*" and "*/"; it should be noted that the annotation characters are all English half-width lowercase.

Example:

If we write a piece of CSS code, we want others to see clearly what it means and which part of the code is the CSS style selector. We can add it in the CSS Add CSS comments.

#header{width:1000px;margin:0 auto}
/* 这个是头部选择器设置总宽度为1000px,并设置DIV布局居中 */

The role of CSS comments

CSS comments are used for annotations. We often use CSS annotations to make special comments on CSS code or layout CSS styles. There are also conditional comments for functional use.

css annotations (css annotations) can help us explain the CSS files we write, such as explaining the location, function, style, etc. of a certain piece of CSS code, so that we can maintain an easy-to-understand CSS file in the future. Convenience. At the same time, when the team is developing a web page, reasonable and appropriate annotations will help the team understand where the css style corresponds to the html, so that the div css web page can be developed smoothly and quickly.

Recommended tutorial: "html video tutorial"

The above is the detailed content of What is the css comment method?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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