Commenting in HTML

Comments, most of us already know what it is. It is used to insert comments in the source code which is not displayed in the browsers.

The basic syntax of HTML comments is <!-- Comments -->

HTML Conditioanl Comments

Conditional Comments are different than normal comments.

This is used only on IE browsers upto version 9. They are mostly useless unless your visitors are still using IE version 9 or below. It is used if you wish to execute some code specifically on these browsers.

<!--[if IE]><link href="iecss.css" rel="stylesheet"><![endif]-->

In the above code, "iecss.css" CSS document will be added if the browser is IE. The other browsers will simply treat it as normal comments.

Next Lesson > Javascript in HTML