猿问

<! - [if!IE]>不工作

我遇到了麻烦


<!--[if !IE]>

上班。我想知道是不是因为我的文件中有这个


<!doctype html>

<!--[if lt IE 7]> <html class="ie6 oldie"> <![endif]-->

<!--[if IE 7]>    <html class="ie7 oldie"> <![endif]-->

<!--[if IE 8]>    <html class="ie8 oldie"> <![endif]-->

<!--[if gt IE 8]><!-->

<html class="">

<!--<![endif]-->

当我添加


<!--[if !IE]><!-->

<link type="text/css" rel="stylesheet" href="/stylesheets/no-ie.css" />

<!--<![endif]-->

由于某种原因,我的标题不起作用。但是,如果我添加


<!--[if !IE]><!-->

    <style>

        All my css in here

    </style>

    <!--<![endif]-->

到实际的html页面(在标题中)它的工作原理。有什么建议?干杯


更新我的问题


好吧,当我删除时,  <!-->我只检查了IE工作,但现在回到FF中,no-ie.css也已应用于FF。所以我添加回来<!-->并删除了/(并将其添加到主模板中,因此cms不会将其添加回来)并且所有都在FF中工作但现在样式表正在应用于IE!所以我试过了


<!--[if IE]>

<link type="text/css" rel="stylesheet" href="/stylesheets/no-ie.css">

<![endif]-->


<!--[if !IE]> -->

<link type="text/css" rel="stylesheet" href="/stylesheets/no-ie.css">

<!-- <![endif]-->

那没用。基本上我正试图让这个页面工作http://css-tricks.com/examples/ResponsiveTables/responsive.php但是将css移动到样式表中。当然,它必须简单。我错过了什么?如果我不需要,我宁愿不使用JQuery。干杯


Cats萌萌
浏览 1178回答 3
3回答

波斯汪

<!--[if !IE]><!--><script src="zepto.min.js"></script><!--<![endif]--><!--[if IE]><script src="jquery-1.7.2.min.js"></script><![endif]-->注意:IE 10以后不再支持这些条件注释。

慕仙森

IE之外的浏览器将条件语句视为注释,因为它们包含在注释标记内。<!--[if IE]>Non-IE browsers ignore this<![endif]-->但是,当您的目标浏览器不是IE时,您必须使用2条注释,一条在代码之前,一条在注释之后。IE将忽略它们之间的代码,而其他浏览器会将其视为普通代码。因此,定位非IE浏览器的语法是:<!--[if !IE]-->IE ignores this<!--[endif]-->注意:IE 10以后不再支持这些条件注释。
随时随地看视频慕课网APP
我要回答