<!--[If!ie]>在这种情况下未按预期工作 [英] <!--[if !IE]> is not working as expected in this case

查看:34
本文介绍了<!--[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 content in here
    </style>
    <!--<![endif]-->

到实际的HTML页(在页眉中),它可以工作。

我如何修复它?

当我删除<!-->时,我只签入了正在工作的Internet Explorer(IE),但现在回到Firefox,no-ie.css文件也已应用于Firefox。所以我在<!-->中重新添加了,并删除了/(并将其添加到主模板中,这样CMS就不会再添加它了),所有这些都在Firefox中恢复工作,但是现在样式表正在应用于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。

推荐答案

<!--[if !IE]><!--><script src="zepto.min.js"></script><!--<![endif]-->
<!--[if IE]><script src="jquery-1.7.2.min.js"></script><![endif]-->
注意:这些条件注释是 no longer supported from IE 10 onwards

这篇关于&lt;!--[If!ie]&gt;在这种情况下未按预期工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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