目标非IE浏览器和特定IE版本的有效条件注释 [英] Valid conditional comments to target non-IE browsers and specific IE versions

查看:139
本文介绍了目标非IE浏览器和特定IE版本的有效条件注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用条件注释指定


  1. 仅限Internet Explorer

  1. Internet Explorer only

某些IE版本

某些IE版本和所有其他浏览器

Certain IE versions and all other browsers

没有IE,只有其他浏览器

No IE, just other browsers

validator.w3.org/

推荐答案

我测试了这些,他们是有效的HTML。

I tested these and they're valid HTML.

重要:只有IE 5到9支持条件注释。

<!-- 1. IE 5-9 only: -->

<!--<![if IE]>
    <link rel="stylesheet" type="text/css" href="ie-5-through-9.css">
<![endif]>-->


<!-- 2. Some IE versions -->

<!--<![if gte IE 8]>
    <link rel="stylesheet" type="text/css" href="ie-8-and-9.css">
<![endif]>-->


<!-- 3. Some IE versions, plus all non-IE browsers -->

<!--[if gte IE 8]>-->
    <link rel="stylesheet" type="text/css" href="ie-gte8-and-non-ie.css">
<!--<![endif]-->


<!-- 4. All browsers except IE 5-9 -->

<!--[if !IE]>-->
    <link rel="stylesheet" type="text/css" href="modern-ie-and-non-ie.css">
<!--<![endif]-->

这篇关于目标非IE浏览器和特定IE版本的有效条件注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆