Comment Tag

The comment tag (<!-- comment -->) is used to insert HTML code comments. It is a good coding practise so that both the coder and the reader can understand the code. The comment tag is useful during code debugging.

  • It is a simple piece of code that web browsers ignore, meaning it is not displayed.

Comments Syntax

<!-- comment -->

In HTML single and multilines comments uses same syntax (<!–- -–>) difference is half part of the comment (”-–>“), is appended where the intended comment line ends.

HTML Comments Example Given Below:

HTML Comments

<!DOCTYPE html>
<p>This is picallens single-line comment</p>
<!-- This is heading tag -->
<p>This is picallens multi-line comment</p>
<!-- This is
comment -->


HTML Comment

Comments are the best way to make your code understandable. Make the habit of adding those in your code. In next lesson we will learn about HTML Elements in detail. Thanks for your Support!