HTML <!– … –> Tag
Last Updated :
18 Apr, 2024
HTML comment tag is used to insert comments in the HTML code. It is good coding practice as it helps developers to better understand complex code. Comments is useful during the debugging of the code.
Syntax:
<!-- Comments here -->
Note: The comment tag () is used for both single line and multiline comments.
Example 1: Basic example of Single Line Comment.
html
<!DOCTYPE html>
< html >
< head >
< title >HTML Single line Comment </ title >
</ head >
< body >
< h2 >Welcome to GFG</ h2 >
< p >Single Line Comment</ p >
</ body >
</ html >
|
Output: Commnets will not be visible in browsers.
HTML Single line Comment Output
Example 2: Multiline Comment is normally used for debugging by keeping content inside of comments.
HTML
<!DOCTYPE html>
< html >
< head >
< title >HTML Comment Tag</ title >
</ head >
< body >
< h2 >Welcome To GFG</ h2 >
< p >Multiline Comment</ p >
</ body >
</ html >
|
Output: Commnets will not be visible in browsers.
HTML Multiline Comment Output
Supported Browser: The browsers supported by HTML comment Tag are listed below.
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...