Comments
Published May 6, 2021Updated Sep 9, 2021
Contribute to Docs
A comment is a piece of text within a style sheet that is not interpreted by the browser. It can be used to provide additional information to aid in understanding the code. By design, comments have no effect on the layout or styling of a document.
Syntax
Comments, are created by an opening /*
and closing */
. Everything in between is commented out.
They can be used on a single line, or across multiple lines:
/* A one-line comment *//*A commentwhich stretchesover several lines*/
Here is an example use case:
/* The comment below is used todisable specific styling */span {color: aqua;font-size: 1.5em;}
Note: In CSS, comments cannot be nested. A /*
*/
comment syntax cannot have another /*
*/
comment syntax inside. The first closing */
ends the comment.
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.