Comments are used to add other related additional information in an HTML document. HTML Comments are displayed only when the source code of a web-page is opened and are not rendered by the browsers on to the web-pages. They are of utmost importance to developers, as they help them to know what actually a piece of code is doing.

Suppose there is a community of developers working on the same project. In this scenario, the work done by one developer needs to be understood by the others. This is actually where the role of comments come into play in order to facilitate communication.

Importance of HTML Comments

  • Improves the readability of the code, especially when a single HTML document is accessed by multiple developers.
  • Ensures quick and efficient understanding of complex codes.
  • Makes debugging of source code easier and ensures easier maintainability.

In this article, we’ll look at commenting single lines, multiple lines, and use of comment tags.

#html

HTML Comments - Types and Examples
1.30 GEEK