Comment is a part of code which is used to add comments into HTML code, particularly in complex documents, to indicate part of a document. Comments assist you and increases code readability.

HTML comments tag start and closed with the following <!– … –> tags and this tag is ignored by the browser.

Example:–

<!DOCTYPE html>

<html>

<body>

<p>This is first paragraph.</p>

<p>This is second paragraph.</p>

<!—This is comment tag –>

<!– Do not display this at the moment
<img border=”0″ src=”comment.png” alt=”comment”>
–>

</body>

</html>

Conditional Comment

Example:–

<!DOCTYPE html>

<html>

<body>

<!–[if IE 8]>
…. some HTML Code here ….
<![endif]–>

<p>This is first paragraph.</p>

<p>This is second paragraph.</p>

</body>

</html>

Multiline Comment

Example:–

<!DOCTYPE html>

<html>

<body>

<!–   This is first line of comment.

This is second line of comment.–>

<p>This is first paragraph.</p>

<p>This is second paragraph.</p>

</body>

</html>

Related Article


0 thoughts on “HTML Comments”

Leave a Reply

Latest Article

HTML

HTML Character Sets

ASCII was the first character set. It describes 127 different alphanumeric characters that can be used on the internet.

HTML

HTML Event Attributes

The following event attributes could be added to all HTML elements where applicable. The event attributes are used for specifying the characteristics of an element

HTML

HTML Tags

HTML Tag are used for making front end part which is visible for visitors. HTML Tag are ,