HTML Comments

Know how comments work in HTML.

HTML comments are used to add notes or explanations to the HTML code, which are ignored by the browser and not displayed on the web page. They are used to provide context or explanations for the code and to make the HTML more readable and easier to maintain.

The syntax for a HTML comment is as follows:

<!-- This is a comment -->

Anything between the opening <!-- and closing --> will be treated as a comment and ignored by the browser. This can be useful for temporarily disabling parts of the code, leaving your with notes or reminders, or collaborating with other developers.

For example:

<!-- This is the header section -->
<header>

Last updated