Home > Web Front-end > CSS Tutorial > How to add comments to css?

How to add comments to css?

青灯夜游
Release: 2019-05-23 18:17:41
Original
4881 people have browsed it

How to add comments to css?

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.

Basic syntax of CSS comments:

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

Description: It starts with "slash asterisk (/*)" and ends with "asterisk slash (*/)". The annotation content is placed between "/*" 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.

Example:

/* css注释实例 */ 

/* body定义 */ 
body{ text-align:center; margin:0 auto;} 

/* 头部css定义 */ 
#header{ width:960px; height:120px;}
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 above is the detailed content of How to add comments to css?. 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