This is an important message requiring you to make a choice if you're based in the EU.

HTML Comments

The HTML comments are used to indicate sections of a document or insert any notes explaining the code. They help you and others understand the code and increase its readability. The comment tag can also be used to exclude temporary code blocks instead of deleting them.

For defining HTML comments we use the <!-- ... --> tag. The browsers ignore this tag and do not show its content to the users.

HTML comments can be used anywhere in the documents except for the <title> tag. They do not work within the <style> tag either, as CSS uses another syntax for comments.


Comments are written between <!-- and --> symbols.


<!DOCTYPE html>
    <title>The title of the document.</title>
    <h1>The main heading</h1>
    <!--  <p>We want to hide this part of the code temporary. </p> -->
    <a href="https://www.w3docs.com">Homepage</a>  
    <!--  <p>This is a link to the homepage</p> -->


Do you find this helpful?

Related articles