How to create conditional comments in HTML?

Front End ScriptsHTMLWeb DevelopmentFront End Technology

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.

Example

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

Live Demo

<!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>
raja
Updated on 15-Jun-2020 08:22:31

Advertisements