Comments are little statements inserted into a block of code which explain the purpose of that section of code, or make notes to yourself or others, or hide things which need to be invisible to the user.
HTML comments look like this:
<!-- This is a comment in HTML -->
CSS comments do NOT look like HTML comments; they follow traditional C/C++ comment syntax. Single line comments are prefixed by slash-slash (//) and end when you type a carriage return. Multiple line comments are prefixed by slash-asterisk (/*) and end with an asterisk-slash (*/).
Example (single line comment):
// this is a single line commentExample (multiple line comments):
/* this is multiple line comment syntax on a single line */ /* This is also a multiple line comment, with multiple lines in it this time. */
Having said this, single-line comments are broken in CSS; do NOT use single line comment syntax! There is only one place in all CSS where you will use a single-line comment, and that is in one spot in an embedded style sheet (which we will discuss in a later section).
Remember: use only MULTIPLE LINE comments when writing CSS!
Note: because CSS documents can get very complicated, you will be using a lot of comments to clarify your code, to yourself and others. Trust me, you will need to write notes to remind yourself of what you were doing, so that six months down the line, you'll be able to remember what you did without re-analyzing all of the CSS again!
Copyright © 2001 Michael Masumoto. All Rights Reserved.