How to write comments in CSS

Topic: HTML / CSS« Prev|Next »

Answer: Use the Syntax "/* text */"

Comments in CSS are typically used to explain the purpose of the style rules declarations. It will help you and others to understand what you were trying to do with the style rules at the time of editing style sheets. Comments are not displayed by the browsers.

A CSS comment begins with /*, and ends with */. See the example below:

  • /* This is a single line CSS comment */
  • /* This is an example of a
  •    CSS multi-line comment */
  • body {
  •     font-family: Arial, sans-serif;
  • }
  • p {
  •     color: #333;
  •     line-height: 1.5;
  • }

Related FAQ

Here are some more FAQ related to this topic:

 
Close

Your Feedback:

 

We would love to hear from you! Please say something.