SummaryEdit
Comments are used to add explanatory notes or prevent the browser from interpreting parts of the stylesheet.
SyntaxEdit
How to read CSS syntax./* Comment */
ExamplesEdit
/* A single line comment */
/*
A comment
which stretches
over several
lines
*/
NotesEdit
The /* */
comment syntax is used for both single and multi line comments. There is no other way to specify comments in external stylesheets. However, when using the <style>
element, you may use <!-- -->
to hide CSS from older browsers, although this is not recommended. As in most programming languages that use the /* */
comment syntax, comments cannot be nested. In other words, the first instance of */
that follows an instance of /*
closes the comment.