Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 条件CSS停止加载内容_Php_Html_Css_Conditional - Fatal编程技术网

Php 条件CSS停止加载内容

Php 条件CSS停止加载内容,php,html,css,conditional,Php,Html,Css,Conditional,好吧,我是新来的,所以请容忍我。我的网站是为InternetExplorer9和Safari、Chrome和Mozilla Firefox建立的。但是当我用InternetExplorer7在我的计算机上加载我的网站时,它会显示这个有条件的div,但它仍然加载它下面的内容。有没有办法阻止它加载内容 以下是我的消息来源: <!--[if lte IE 8]> <div style=' clear: both; text-align:center; position: relati

好吧,我是新来的,所以请容忍我。我的网站是为InternetExplorer9和Safari、Chrome和Mozilla Firefox建立的。但是当我用InternetExplorer7在我的计算机上加载我的网站时,它会显示这个有条件的
div
,但它仍然加载它下面的内容。有没有办法阻止它加载内容

以下是我的消息来源:

<!--[if lte IE 8]>
<div style=' clear: both; text-align:center; position: relative;'>
    <a href="http://windows.microsoft.com/en-US/internet-explorer/downloads/ie-9/worldwide-languages"><img src="/protected-wp-content/images/internet-explorer-9-update.png" border="0"  alt="" /></a>
    </div>
<![endif]-->

<!--[if IE 9]>
<script type="text/javascript" src="js/html5.js"></script>
<link rel="stylesheet" href="css/ie.css" type="text/css" media="screen">
<![endif]-->

您可以在

<!--[if gte IE 9]>
   Stuff only Internet Explorer 9 should see..
<![endif]-->

使用JavaScript,您可以隐藏下面加载的div。当然,当InternetExplorer10问世时,这将中断并需要修改:

<div id='divContainingIE9Content'></div>
<script type='text/javascript'>
    if (navigator.userAgent.indexOf("MSIE 9") > 0) {
        document.getElementById("divContainingIE9Content").style.display = 'none';
    }
</script>

if(navigator.userAgent.indexOf(“MSIE 9”)>0){
document.getElementById(“divContainingIE9Content”).style.display='none';
}
如果您的观点是允许在页面正文中使用“-”,则可以将其括在

<!--[if lte IE 8]><div style="display:none"><[endif]-->
...
<!--[if lte IE 8]></div><[endif]-->

...

(但是对于那些旧到根本不使用CSS的IE版本来说,这是行不通的(在野外有很多这样的版本吗?)

所以,你似乎希望IE 8和用户只看到更新链接

撇开这是否是个好主意不谈,下面是如何做到的:

<!--[if lte IE 8]>
    <div style=" clear: both; text-align:center; position: relative;">
        <a href="http://windows.microsoft.com/en-US/internet-explorer/downloads/ie-9/worldwide-languages">
            <img src="/protected-wp-content/images/internet-explorer-9-update.png" border="0"  alt="" />
        </a>
    </div>

    <script type="text/javascript">
        document.execCommand("Stop", true, null);
    </script>
<![endif]-->


execCommand(“Stop”)
停止IE中的页面加载(在其他浏览器中不一致,但这不是问题)。

lte IE 8
意味着“小于等于IE 8”,因此这似乎可以按设计工作。你能澄清问题是什么吗?是的,它会显示更新框。但我想知道是否有任何方法可以阻止它显示此语句下面的html内容,而只在其他浏览器中显示它。它看起来更专业啊,下面的代码一秒钟前在我的浏览器中是看不见的。你是说IE9的内容在IE7中是可见的?但IE9块不包含任何实际显示的内容,是吗?(旁注:样式表在文档正文中无效,它们应该在
标题部分中)基本上,这些页面是为ie9和webkit浏览器设计的,我不希望它们被ie9下面的任何ie显示。我只想要更新部分。我不知道,但我不想拥有全部conditional@DavidPassmore您可以使用javascript设置CSS属性
display:none也是。见上文。你说你不想让它显示在IE小于8的屏幕上。这就是条件化的定义……我的意思是,如果我能帮上忙,我不希望所有的内容都包含在条件标记中。那么,在下面开始一个HTML注释并关闭它怎么样?(处理不支持CSS的浏览器)-即使IE 5也支持CSS。IE条件是HTML注释,据不认识它们的浏览器所知。谢谢你,这就是我一直在寻找的东西!只是出于兴趣为什么不是一个好主意?这不是一个好主意,因为你将不必要地失去一些客户/客户。例如,在我的网站上,我只是要求他们更新!只是因为我的css是围绕chrome和Mozilla设计的,而且我的大多数客户中有79%左右使用这些浏览器,其他人非常乐意更新,谢谢你的帮助。