HTML Comments

Comments

  1. Multiline Comments
  2. Conditional Comments

Multiline Comments

  • HTML supports the multi-line comments.
  • You can comment multiple lines by the beginning tag <!– and ending tag –>.
Example 1

<!DOCTYPE html><html>
<head>
<title></title>
</head>
<body>
<!–
Multiline comment
can hide the contents
which are not Important to display
–>
<p>Shows Multine Comments…..</p>
</body>
</html>

Output
Multiline Comments

Shows Multine Comments…..

Conditional Comments

  • Conditional comments used in different versions of Internet Explorer for different style sheet.
Example 2
<!DOCTYPE html><html>
<head>
<title></title>

<!–[if condition]>
Conditional Comments
<![endif]–>

</head>
<body>
<p>Conditional Comments…..</p>
</body>
</html>

Output
Conditional Comments

Conditional comments …..

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *