css - 为什么我的 CSS 不能在 IE 8 和 IE 7 中运行?

标签 css internet-explorer internet-explorer-8 cross-browser internet-explorer-7

此 CSS 中的哪些内容在 IE8 和 IE7 中不起作用?

nav {
position: fixed;
top:60px;
left:30px;
color:black;
float:left;
}
nav div#button {
    width:205px;
    height:50px;
    text-align: center;
    padding-top:  5px;
    margin-bottom:10px; 
    font-size: 23px;
}
nav a {
    color: #000000;
    text-decoration: none;
}
nav div#button:active  {
    width:250px;
    height:65px;
}
nav div#button.home {
    background-color: #79b22c;
}
nav div#button.links {
    background-color: #3b50cc;
}
nav div#button.aanbod {
    background-color: #BA3BCC;
}
nav div#button.forum {
    background-color: #1CAEB2;
}
nav div#button.contact {
    background-color: #daa520;
}

它在 IE9 和 IE10 中运行良好。但是 IE8 & IE7 显示无样式文本。 我已经使用 browserstack 进行了测试。 谁能帮帮我?

最佳答案

<nav>和其他 HTML5 元素是在 IE 7 和 IE 8 发布后定义的,因此浏览器不知道如何处理它们。

但是,可以指示他们处理它们。而且, html5shiv 可以帮助解决这个问题:

Include the HTML5 shiv at the top of your <head> in a conditional comment after any stylesheets.

<!--[if lt IE 9]>
    <script src="html5shiv.js"></script>
<![endif]-->

关于css - 为什么我的 CSS 不能在 IE 8 和 IE 7 中运行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17589098/

相关文章:

html - 如何仅使用内联 CSS 将滚动框定位在图像顶部

html - 我无法删除字母之间的间距。即使字母间距为 0px,它仍然有太多空间

html - IE 不居中这些图像,有解决办法吗?

javascript - location.assign 在 IE 中不起作用

asp.net - 绕过证书错误

javascript - 获取元素位置 scrollTop

javascript - 如何在 chart.js 中将 `fillColor` 设为渐变?

javascript - 如何使用默认文件处理程序打开 html 文件并为窗口命名(即目标)?

javascript - 样式化输入类型 ="file"

html - IE8 CSS 宽度,不能用百分比?