HTML Comments
HTML comments are not visible in the browser, but they can help document or file your HTML source code.
How to add comment In HTML:
Add comments in your HTML file using <! — … –> tag. So if you will write anything between these comment tags that will be treated as a comment and the browser will not read it.
Syntax:
<! -- Write commented text here -->
Example:
<!DOCTYPE html> <html> <!-- This is Header section --> <head> <!-- Internal CSS --> <style> body{ text-align: center; background-color: black; font-size: 30px; color: red; } </style> </head> <!-- This is body section, write code here which you want to display on web-page --> <body> <!-- heading tag --> <h2>First WebPage</h2> <!-- Paragraph tag --> <p>Write your Content here!!!</p> </body> </html>
OUTPUT:
Multiline Comment:
We can also comment on multiple lines at a time. In multiline comments, we can use any description about code or multiple line codes to debug, etc.
Syntax:
<!--- enter content here1. enter content here2. enter content here3.-->
Example:
<!DOCTYPE html> <html> <head> <style> body{ text-align: center; background-color: #98f5ff; } </style> </head> <body> <h2>I2 tutorails is the best tutorial</h2> <!-- enter content here1 enter content here1 enter content here1--> </body> </html>
OUTPUT: