HTML comments

HTML comments are used to add notes or explanations within the HTML code, which are not displayed in the web browser. They are useful for documenting the code, explaining the structure, or temporarily disabling parts of the code. HTML comments are enclosed within <!-- and --> tags.

Here is an example of an HTML comment:


<!-- This is a comment -->
<p>This is a paragraph.</p>
<!-- <p>This paragraph is commented out and will not be displayed.</p> -->

In this example, the first line is a comment that won’t be displayed on the web page, and the second comment surrounds a paragraph tag, making the browser ignore it. Comments can be very useful for developers to leave notes or explanations about the code.