Home >Web Front-end >Front-end Q&A >How to comment out css code

How to comment out css code

藏色散人
藏色散人Original
2023-01-31 10:56:412716browse

The way to comment out css code is to start with the "/*" symbol and end with the "*/" symbol; examples of css comment code are such as "/* This is a single line comment */p {color: red; }", you can also add comments anywhere in the code, comment code such as "p {color: red; /* Set the text to red*/}".

How to comment out css code

The operating environment of this tutorial: Windows 10 system, CSS3 version, DELL G3 computer

How to comment out the css code?

CSS Comments

Comments are used to explain the code and may be helpful later when you edit the source code.

Browsers will ignore comments.

CSS comments located within the c9ccee2e6ea535a969eb3f532ad9fe89 element, starting with /* and ending with */:

Example

/* 这是一条单行注释 */
p {
  color: red;
}

Comments can be added anywhere in the code :

Example

p {
  color: red;  /* 把文本设置为红色 */
}

Comments can span multiple lines:

Example

/* 这是
一条多行的
注释 */ 
p {
  color: red;
}

Recommended study: "css video tutorial"

The above is the detailed content of How to comment out css code. 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