treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Comments in CSS

Last updated on:

body {
    font-size: 62.5%  /* 1em = 10px */
}

The stuff inside the /* */ marks are CSS comments. This allows you to enter notes into CSS that will not be interpreted. In this case, this comment lets someone reading the CSS file know that that particular line of CSS was intended to allow for using ems to set font size later in the CSS in a more intuitive base 10 way.

View Comments

Comments

  1. sadasdasd

  2. T-rock

    Good documents Thank u….

  3. Great for me..

  4. Permalink to comment#

    Elaborating..

    /*
    * === MAJOR SECTION HEADING ===
    */

    /*
    * — Minor Section Heading —
    */

    I prefer comment to appear this way, but everyone is different how they comment. One this thing is for sure. You can never comment too much! (as they stripped anyhow in css compression).

  5. Permalink to comment#

    thank u very much… that’s help me

  6. Anoniem
    Permalink to comment#

    I have two little (newbie) questions:
    1. Are comments still the same in CSS3?
    2. What about comments in html5?

    • MaxArt
      Permalink to comment#

      Yes, of course. CSS3 is CSS.
      You have to include them between . Just like plain old HTML or XML.

    • MaxArt
      Permalink to comment#

      2) Whooops… I meant between <!– and –>.

    • me
      Permalink to comment#

      In SCSS, you can use:
      // comment
      or:
      /Comment
      Still a comment
      still a comment
      /



  7. Thanks “me, I’m working with scss ^^

  8. Permalink to comment#

    How is this Comment Preview possible below this? Is this a plugin in WordPress? So cool.

  9. Emmad
    Permalink to comment#

    I don’t like the fact that you need 4 characters to comment a single instructions on a line! It would have been better to use something simpler in addition to the /* */. For example, SQL uses two consecutive dashes like — which is very easy to use, another one is a single quote at the beginning of the line like VB. Anyway, this is still better than the most silly comment syntax for HTML.

Leave a Comment

Use markdown or basic HTML and be nice.