html 元素背景颜色未在 IE 8 中显示

标签 html css internet-explorer internet-explorer-8 background-color

我正在使用 <body>在每个背景颜色均为白色的网站上标记为三个 div 的包装器。

我已经将 css 中的 html 和 body 的背景颜色设置为#fff,该站点在除 IE8 之外的所有浏览器(包括 IE 6 和 7)中都可以正确呈现:

Only one of the divs (the central content) is displaying its background color

我什至试过像这样直接内联设置 html 的样式:<html style="background-color: #fff">但这似乎并没有改变任何事情。

甚至不确定是什么导致了错误。

最佳答案

问题出在您的 CSS 中的以下属性:

:focus{
  outline:0;
  background-color:#f2f3f6;
  border-color:#996
}

显然,在加载时 IE8 决定 html 元素具有焦点,而其他浏览器不这样做。在这里删除背景颜色属性,它会保持白色。

关于html 元素背景颜色未在 IE 8 中显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5345446/

相关文章:

c# - IE 用户代理正则表达式(包括 IE11 和紧凑 View )

javascript - 为什么 Angular-xeditable 在第一次运行时不突出显示当前值?

css - 有没有办法让这种字体在我的网站上工作?

javascript - 在IE11中,如何使用console.log?

javascript - 对齐 &lt;input type ="text"> 和 <select></select>

html - 如何在ionic 3中使脚覆盖页面的整个宽度

html - 如何在 Firefox 中设置选择框及其边框的颜色?

HTML、CSS : Header appears behind the other content

php - 如何获取另一个页面的id并使其根据id显示值

javascript - HTML 表格循环遍历每一行