如何在HTML中创建条件注释?

HTML目标Internet Explorer中的条件注释。它们定义了一些标记,这些标记由Microsoft Internet Explorer执行。它为注释添加了其他语法,并且从Explorer 5开始受支持。

浏览器不知道条件注释会将其视为任何其他注释。

示例

您可以尝试运行以下代码,以了解如何在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>