print
Advertisment
Advertisment

HTML Comment

Comment is a piece of code which is ignored by any web browser. It is a good o practice to add comments into your HTML code , especially in complex document to indicate sections of a document and any other notes to anyone looking at the code . Comments help you and others understand your code and increases code readability .

HTML comments are placed in between <!--_-> tags.So any content placed within <!--_--> tags will be treated as comment and will be completely ignored by the browser .

Multiline Comments

So far we have seen single line comments , but HTML supports multi-line comments as well . You can comment multiple by the special beginning tag <!-- and ending tag --> placed before the first line and end of the last line as shown in the given example below -

Conditional Comments

Conditional comments only work in Internet Explorer on Windows but they are ignored by other browsers . They are supported from Explorer 5 onwards and you can use them to give conditional instructions to different versions of IE .

Using Comment Tag

There are few browsers that support <comment> tag comment a part of HTML code .

NOTE-The tag deprecated in HTML5 .Do not use this element .

Advertisment
Advertisment
arrow_upward