HTML comment tag is used to insert comments in the HTML code. It is a good practice of coding so that the coders can get helpful to understand the complex code. The comment tag is useful during the debugging of codes.
Syntax:
<!-- Comments here -->
Example 1: Single-line comment used to increase the code readability.
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.
Last Updated :
29 Feb, 2024
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...