Comments

Syntax:

<!-- Comment text goes here -->

 

There can be no spaces between the opening <!-- characters or closing --> characters.

 

Multiline comments appear between the opening and closing characters:

 

<!--

Comment

text goes

here

-->

 

 

Conditional Comments

 

Only works in IE and are ignored by other browsers!

 

<!--[if IE 6]>

Special instructions for IE 6 here

<![endif]-->

 

The following tests can also be incorporated

  • lt = less than
  • lte = less than equal
  • gt = greater than
  • gte = greater than equal
  • ! = not

Example:

<!--[if lte IE 6]>

<link rel="stylesheet" type="text/css" href="ie6.css" />

<![endif]-->

 


 

You may also find comments used in scripts and stylesheets for older browsers:

 

Leave a Reply