<!--[如果 !IE]>不工作 [英] <!--[if !IE]> not working

查看:25
本文介绍了<!--[如果 !IE]>不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在获取时遇到问题

<!--[if !IE]>

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

to work. I'm wondering if it is because I have this in my document

<!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]-->

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

to my header for some reason it doesn't work. However if I add

<!--[if !IE]><!-->
    <style>
        All my css in here
    </style>
    <!--<![endif]-->

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

to the actual html page (in the header) it works. Any suggestions? Cheers

更新我的问题

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

Ok, when I removed <!-->I only checked in IE which was working but now back in FF the no-ie.css had been applied to FF too. So I added back in the <!-->and removed the / (and added that into the main template so the cms wouldn't add it back in) and all is working back in FF but now the stylesheet is being applied to IE! So I tried

<!--[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.干杯

And that didn't work. Basically I'm trying to get this page to work http://css-tricks.com/examples/ResponsiveTables/responsive.php but move the css into a stylesheet. Surely it's got to be simple. What am I missing? I'd rather not use JQuery if I don't have to. Cheers

推荐答案

<!--[if !IE]><!--><script src="zepto.min.js"></script><!--<![endif]-->
<!--[if IE]><script src="jquery-1.7.2.min.js"></script><![endif]-->

注意:这些条件注释是从 IE 10 开始不再支持.

Note: These conditional comments are no longer supported from IE 10 onwards.

这篇关于&lt;!--[如果 !IE]&gt;不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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