Adding Comments to Style Rules

It's a good idea to add comments to your style sheets so that you can remember what particularly complicated style rules are supposed to do. When you come back later, you'll be happy you left yourself these reminders.

To add comments to style rules:


In your style sheet, type /* to begin your comments.


Type the comments.


Type */ to signal the end of the comments.


  • Comments may include returns, and thus span several lines.

  • You can put comments around style rules effectively hiding them from the browser. This is a good way to test style sheets without permanently removing problematic portions.

  • You may not put comments inside other comments. In other words, comments may not include */.

  • You may start comments on their own line (Figure 7.3), or at the end of a style rule (Figure 7.4).

    Figure 7.3. Comments can be used to describe style rules so that they are easier to edit and update later on. (OK, this one isn't very complicated, but yours might be.)

    Figure 7.4. If you prefer, you can insert comments after a style rule.

HTML, XHTML, & CSS(c) Visual QuickStart Guide
HTML, XHTML, and CSS, Sixth Edition
ISBN: 0321430840
EAN: 2147483647
Year: 2004
Pages: 340

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: