How to comment in css

藏色散人
Release: 2023-01-07 11:41:55
Original
7376 people have browsed it

You can use the "/* */" symbol to comment in CSS. Comments can be written in any position that allows spaces in the style sheet. Comments can be written in one line or multiple lines. The comment syntax is such as "/ * Comment */".

How to comment in css

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

How to comment in css?

CSS comments

CSS comments are used to add additional explanations to the code, or use To prevent browsers from parsing CSS code in specific areas. Comments have no effect on document layout.

Syntax

Comments can be written anywhere in the style sheet where spaces are allowed. Comments can be written on one line or on multiple lines.

/* Comment */
Copy after login

Example

/* 这是一行单行注释 */
/*
分为
几行
的
注释
*/
/* 下面的注释用于禁用特定的样式 */
/*
span {
  color: blue;
  font-size: 1.5em;
}
*/
Copy to Clipboard
Copy after login

Description

/* */ style comment syntax can be used as a single-line comment or as a multi-line comment. There is no other way to declare annotations in an external, standalone CSS file. However, if the CSS code is written in the