Html Readers

HTML Comment Tag

The comment tag is a special type of tag in HTML. It is used to include comments or message in the source code which will ignore by any web browser or not displayed in the browser. By using comment tag you can make your complex HTML code easy to understand and easy to editable. You can use comment tag for a single line or multi-line in HTML code.

Syntax


<!--…….-->
<! -- And -->
<!-- This is the my comment. Following is code for heading and paragraph -->

<h1>this is a Heading. </h1>
<p>This is example of html comment tag</p>


How to use

Example -1 single line
<!DOCTYPE html>
<html>
<head>
<title>This is document title.</title>
</head>
<body>
<!--This is the my comment. Following is code for heading and paragraph-->
<h1> This is a heading</h1>
<p>Paragraph -Document description goes here......</p>
</body>
</html>
Example -1 Multi-line
<!DOCTYPE html>
<html>
<head>
<title>This is document title.</title>
</head>
<body>
<!— This is my multi line comment.
Following is code for heading and paragraph. -->

<h1> This is a heading</h1>
<p>Paragraph -Document description goes here......</p>
</body>
</html>

Events

Does not support events

Attribute

Does not support events

Browsers Compatibility

Yes all browser support

Support In

Element Html 4.01 Html 5
<!-- --> YES YES

Apply CSS

Not apply

Quick View

html comment Tag

Note

Do not allow space between less than angular bracket (<), exclamatory sign (!) and the double minus sign (-‐) in start standard comment tag syntax, similarly in end comment tag syntax. Comment tag can be used only in Head and Body section of the HTML document. You can comment an Html code.

Nesting Tag

Comments do not support nest of comment tag in HTML document. You cannot be put comment tag inside another comment.

Do practice