HTML Comment Tag

HTML Comment Tag

The HTML comment tag is used to write comments in main code file. The comments that we write are not displayed on the browser like other HTML content. It is only for programmers.

How to write HTML Comment Tag

To write comment using HTML Comment Tag is very simple, below is the example.

<!DOCTYPE html>
<html>
<body>
<!--I am a comment. I live inside HTML Comment Tag.
Read me to know about this code. This piece of code 
is about HTML Comment Tags.-->
</body>
</html>

HTML Comment Tag Usage

Comments are very helpful and it's always suggested to write comments in your code. Comments can tell you about the purpose of a particular piece of code which can help you when you edit the code in future.

Comments act as Note to any programmer who reads it or works on it. Comment tag is used to explain your code.

You can use HTML comment tag to hide or comment out the scripts and your browser won't notice it.

<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
<!--
function displayMsg() {
  alert("This Script won't be executed")
}
//-->
</script>
</body>
</html>

Note: HTML Comment Tag doesn't support standard or event attributes.

HTML Comment Tag Video

Watch our video on comment tag and subscribe our Youtube Channel.

HTML anchor Tag HTML abbr Tag HTML acronym Tag HTML address Tag HTML applet Tag HTML area Tag HTML article Tag HTML aside Tag HTML audio Tag HTML b Tag HTML base Tag HTML basefont Tag HTML bdi Tag HTML bdo Tag HTML big Tag HTML blockquote Tag HTML body Tag HTML br Tag HTML Button Tag HTML Canvas Tag HTML Caption Tag HTML Center Tag HTML Cite Tag HTML Code Tag HTML Col Tag HTML colgroup Tag HTML comment Tag HTML data Tag HTML datalist Tag HTML dd Tag HTML del Tag HTML details Tag HTML dfn Tag HTML dialog Tag HTML dir Tag HTML div Tag HTML dl Tag HTML Doctype Tag HTML dt Tag HTML em Tag HTML embed Tag HTML fieldset Tag HTML figcaption Tag HTML figure Tag HTML font Tag HTML footer Tag HTML form Tag HTML frame Tag HTML frameset Tag HTML Heading Tags HTML head Tag HTML header Tag HTML hr Tag HTML html Tag HTML i Tag HTML iframe Tag HTML img Tag HTML input Tag HTML ins Tag HTML kbd Tag HTML label Tag HTML legend Tag HTML li Tag HTML link Tag HTML main Tag HTML map Tag HTML mark Tag HTML meta Tag HTML meter Tag HTML nav Tag HTML noframes Tag HTML noscript Tag HTML object Tag HTML ol Tag HTML optgroup Tag HTML option Tag HTML output Tag HTML p Tag HTML param Tag HTML picture Tag HTML pre Tag HTML progress Tag HTML q Tag HTML rp Tag HTML rt Tag HTML ruby Tag HTML s Tag