Dofactory.com
Dofactory.com
Earn income with your CSS skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

CSS Comments

A CSS comment is text that is marked as documentation.

Comments are for developers only. They are not visible to the users.

Comments are written with /* ... */ and span one or more lines.

Example

#

A comment inside a <style> element.

<style>
  /* Styling for a message box */
  .message {
    background: moccasin;
    padding: 20px;
  }
</style>

Multi-line comments

Comments can span multiple lines, like so.

<style>
  /*
    A multi-line style.
    That can span many lines.
   */
  .message {
    background: moccasin;
    padding: 20px;
  }
</style>

Comment styles

Below is a commonly used flowerbox commenting style.

<style>
  /***********************************************
   * A flowerbox commenting style
   *
   * 1) detail one
   * 2) detail two
   *
   ***********************************************/
  .message {
    background: moccasin;
    padding: 20px;
  }
</style>

And this is another neat commenting style.

<style>
  /*
   * A neatly arranged commenting style
   *
   * 1) detail one
   * 2) detail two
   *
   */
  .message {
    background: moccasin;
    padding: 20px;
  }
</style>

You may also like


Last updated on Sep 30, 2023

Earn income with your CSS skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

Guides