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:

1.
In your style sheet, type /* to begin your comments.
2.
Type the comments.
3.
Type */ to signal the end of the comments.

✓ Tips

  • 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 ...

Get HTML, XHTML, & CSS, Sixth Edition: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.