Home >Web Front-end >CSS Tutorial >What are the two ways to write css comments?
The two ways to write css comments are single-line comments and multi-line comments. The syntax format is [/* Comment */]. There is no other way to declare annotations in an external, standalone CSS file. The first [*/] mark after [/*] will end the comment.
The operating environment of this article: windows10 system, css 3, thinkpad t480 computer.
CSS comments are used to add extra explanation to the code, or to prevent the browser from parsing CSS code within a specific area. Comments have no effect on document layout.
The syntax is as follows:
Comments can be written anywhere in the style sheet that allows spaces. Comments can be written on one line or on multiple lines.
/* Comment */
Example:
/* 这是一行单行注释 */ /* 分为 几行 的 注释 */ /* 下面的注释用于禁用特定的样式 */ /* span { color: blue; font-size: 1.5em; } */
(Learning video sharing: css video tutorial)
Description:
/* */ Style The 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 c9ccee2e6ea535a969eb3f532ad9fe89 tag, in some older browsers you can also use 19791207a4e0a22c816ac020ecd8cae0 to comment the CSS code, although this is not possible. recommended. Like most other programming languages that use the /* */ syntax for comments, comments cannot be nested. In other words, the first */ mark after /* will end the comment.
Related recommendations: CSS tutorial
The above is the detailed content of What are the two ways to write css comments?. For more information, please follow other related articles on the PHP Chinese website!