html - DIV 覆盖整个页面(IE7)

标签 html css internet-explorer

我想要实现的是告诉使用旧版 IE 的用户他们将无法正确查看网站,因为 IE 不支持许多现代技术。 当然,我可以使用和提醒弹出窗口,但我想在整个页面上打开一个图层。

我曾尝试使用固定的 div 来实现此目的,但没有奏效。 IE 只是在页面顶部显示 div,而不是从一侧到另一侧覆盖页面。

这是我的 CSS

background-color: #c0c0c0;
    position:fixed;
    top:0;
    left:0;
    width:100%;
    height:100%;
    z-index:100;

我在其他帖子中读到问题可能出在将 div 放在 body 内......所以我将它移到外面,但结果是一样的。

这是我正在使用的代码片段

<?

 $ie6 = "MSIE 6.0";  
 $ie7 = "MSIE 7.0"; 
 $ie8 = "MSIE 8.0"; 
 $ie9 = "MSIE 9.0"; 

 $browser = $_SERVER['HTTP_USER_AGENT'];  

 $browser = substr("$browser", 25, 8);  

 if($browser == $ie6 || $browser == $ie7 || $browser == $ie8 || $browser == $ie9){ 

//echo "<script>alert('Your Browser is Internet Explorer version $browser. Please update your browser to Internet Explorer version 10 to view the website correctly. IE versions under 10 does not support many of the modern web technologies and therefore you will not see the website correctly. You can also use other browsers like Chrome, Mozila, Opera, etc');</script>";
print "<div class=ie><div class=ie_message>Your Browser is Internet Explorer version $browser. Please update your browser to Internet Explorer version 10 to view the website correctly. IE versions under 10 does not support many of the modern web technologies and therefore you will not see the website correctly. You can also use other browsers like Chrome, Mozila, Opera, etc</div></div>"; 
}  
?>

无法提供链接,因为我正在测试是否在本地服务器上

谢谢

最佳答案

有些浏览器不支持fixed位置,请尝试absolute位置:

background-color: #c0c0c0;
position:absolute; /* <-- absolute position */
top:0;
left:0;
width:100%;
height:100%;
z-index:100;

关于html - DIV 覆盖整个页面(IE7),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18809200/

相关文章:

html - WordPress 中的 CSS Circle Mods,在哪里插入代码?

jquery - 使用 jQuery Cycle 在 IE8 及以下版本中出现透明 PNG (24) 问题

.net - WatiN 停产了吗?

html - 背景图片在 IE 中不显示

html - Charts.js 图表不显示

css - 动态加载列表时封装嵌套列表

html - 在没有 rtl 的表中将文本溢出到左侧

javascript - 如何将标签保留在可调整大小和可滚动的 div 内的一个位置?

android - html声音元素中无法识别nativescript-audio录音

html - 如何使表格标题的高度彼此不同?