【发布时间】:2014-07-26 09:38:51
【问题描述】:
我在下面有这个 CSS,但它在 IE8 上不起作用。我知道 CSS3 在 IE8 上不起作用。
我想尝试div:first-child + div + div 之类的方法,但它不起作用。我认为它不起作用是因为nth-last-child()。我无法用相邻的兄弟组合符 (+) 翻译 nth-last-child()。
/* one item */
div:nth-child(1):nth-last-child(1) {
width: 100%;
}
/* two items */
div:nth-child(1):nth-last-child(2),
div:nth-child(2):nth-last-child(1) {
width: 50%;
}
/* four items */
div:nth-child(1):nth-last-child(4),
div:nth-child(2):nth-last-child(3),
div:nth-child(3):nth-last-child(2),
div:nth-child(4):nth-last-child(1) {
width: 25%;
}
【问题讨论】:
-
那是因为 IE8 不支持 CSS3。
-
@3rror404 我知道
-
IE8 确实支持
:first-child。 link
标签: html css internet-explorer-8