HTML comment Tag
-
HTML
<comment>
tag is use for insert a comment in the source code. It's important to easy code readability and understand. -
You can also write specifies information inside comments. In this case they will not be display on web document and not visible for the user.
-
A good habit is write comment text inside html pages, scripts and style elements.
-
Comment Tag does not support any Standard Attributes.
HTML Comment Example
An HTML comment begins with "<!--" and ends with "-->".
<html>
<head>
<title> HTML Comment Tag </title>
</head>
<body>
<img src="../../images/w2t.png" width="365" height="86" /> <!-- Image File -->
</body>
</html>
CSS Comment Example
A CSS comment start with "/*" and ends with "*/" in css file.
/* CSS Style */
h4 {
text-align: center;
color: purple; /* Font Color is purple */
font-family: verdana;
}
JavaScript Comment Example
Single line comment start with //.
Multi line comment start with /* and end with */.
<script type="text/javascript">
// start heading h3
document.write("<h1>This is a heading h3</h1>");
/*
The fist code is use to h3 heading
or line break
*/
document.write("<h1>This is a heading</h1>"+"<br />");
</script>
Browser Compatibility
- Google Chrome
Yes - Mozilla Firefox
Yes - Microsoft Edge
Yes - Opera
Yes - Safari
Yes