css - IE8 不遵守基本的 CSS 规则

标签 css internet-explorer-8

我的 website 上有一个固定的页脚为了在它和主要内容之间留出空间,我给后者留了一个底边距。这在 Chrome 和 Firefox 中运行良好。

enter image description here

我使用的规则是

div#wrap>div:last-child{ 
margin-bottom:45px;
}

但是,IE8 似乎不遵守这个(非常基本的!)CSS 规则,如下所示。

enter image description here

在 IE8 提供任何错误/警告的范围内,它没有提到任何有关此规则有问题的信息。增加 margin-bottom 没有任何效果,所以这条规则似乎被完全忽略了。有人明白为什么吗?对此有什么好的解决方法?

最佳答案

:last-child 是一个 css3 选择器,如果使用,将不会在 ie8 中应用。

第一个替代方案(不推荐)

:first-child+(all the tags until the end) //:first-child+div+div+td+....
{
margin-bottom:45px;
}

选项 2(推荐) 给最后一个 child 上课并添加你的 css 样式

关于css - IE8 不遵守基本的 CSS 规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21036957/

相关文章:

jquery - HTML Select 标签显示带有 10 个选项的垂直滚动

css - 如何在 CSS 中第二次单击时失去焦点超链接

CSS 将样式设置为类 ="something"标签的父级

css - 在页脚中显示菜单,但在移动设备上显示在页眉中

html - 不能改变一个颜色

jquery - swfObject 导致 "Object doesn' t support“__flash__addCallback 函数中的错误

javascript - 当我使用 equalHeights jQuery 插件时,IE8 返回 “object doesn' t support this property or method”

flash - video.js - 控件未在 IE8 中显示

jquery - jQuery 的 fadeIn() 和 fadeOut() 不适用于 IE 8 吗?

javascript - 浏览器更新消息 Internet Explorer 8