HTML comment tags are usually used to insert a comment in HTML documents. If the document is complex, then html comment is essential, as it can make better the document.
You can add comments to your HTML source by using the following syntax −
<!-- Write your comments here -->
Remember, comment does not appear nor displayed by the browser; however, it helps the html source code.
Further, through comments you can put reminder in html. Comments also help in debugging html.
Html comments is a comment code which are used to explain what the code does and the comments are not displayed by all the browsers and are very useful when the user dealing with lot of code. Comments does not have any Attribute values.
Usually comments are placed in between the <!– …–!> tags as shown in the below snippet code.
<!DOCTYPE html> <html> <body> <!-- This is a comment --> <p>This is a paragraph.</p> <!-- Comments are not displayed in the browser --> </body> </html>
In Html whatever the content placed in between the <– ….–> tag is an ignored content by all the browser.
The figure below demonstrates the html comments.
This is a paragraph.