CSS - Comments
Comments are used to add explanatory notes or prevent the browser from interpreting parts of the stylesheet.
Example
/* A single line comment */ /* A comment which stretches over several lines */
Syntax
/* Comment */
Description
Comments are used to add explanatory notes or prevent the browser from interpreting parts of the stylesheet.
Notes
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.
See Also
- CSS Reference
- CSS Key Concepts: CSS syntax, at-rule, comments, specificity and inheritance, the box, layout modes and visual formatting models, and margin collapsing, or the initial, computed, resolved, specified, used, and actual values. Definitions of value syntax, shorthand properties and replaced elements.
Specifications
License
© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/css/comments