Advertisement
Google Ad Slot: content-top
Comments
In HTML, comments are used to insert notes or explanations within the code that will not be displayed on the webpage. They are helpful for documenting the code, leaving reminders, or temporarily disabling parts of the code during development.
How to Write Comments in HTML
- HTML comments start with
<!--and end with-->. - Anything between these markers will be treated as a comment and ignored by the browser.
Example
<!-- This is a comment -->
<p>This is a paragraph that will be displayed.</p>
<!-- <p>This paragraph will not be displayed because it is inside a comment.</p> -->
Output
In this example:
- The first line is a comment and will not be shown on the webpage.
- The second line is a normal paragraph that will be displayed.
- The third line contains a paragraph inside a comment, so it will not be displayed.