Computer >> Computer tutorials >  >> Programming >> HTML

How to create conditional comments in HTML?


Conditional comments in HTML target Internet Explorer. They define some tags, which get executed by Microsoft Internet Explorer. It adds additional syntax to comments and supported from Explorer 5 onwards.

Browsers aren’t aware of the conditional comments will consider this as any other comment.

How to create conditional comments in HTML?

Example

You can try to run the following code to learn how to add conditional comments in HTML

<!DOCTYPE html>
<html>
   <head>
      <title>HTML Conditional Comments</title>
      <!--[if IE 9]>
         Special instructions for IE 9 here
      <![endif]-->
   </head>

   <body>
      <p>This is demo content.</p>
   </body>
</html>