CSS Comments

In CSS, a comment starts with /* and ends with */. Comments can span multiple lines, but may not be nested:

/* This is a single-line comment */

/* This is a comment that
   spans multiple lines */

According to the CSS2 specification, comments that appear between tokens won’t have any effect on the styles’ rendering. In practice, however, we find comments causing errors in some older browsers in certain situations.

Note: Comment Syntax

The // comment syntax used in C++ is not allowed. Neither are SGML comments that take the form <!---->, except in one situation: they may appear in internal style sheets—style sheets placed within the HTML source using the <style> tag—in order to hide the CSS statements from pre-HTML4 user agents. However, this use of comments is now redundant and can be disregarded. See Linking CSS to a Web Document for further information.

User-contributed notes

Related Products