【问题标题】:How to use :nth-last-child in IE8? [duplicate]如何在 IE8 中使用 :nth-last-child? [复制]
【发布时间】: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%;
}

【问题讨论】:

标签: html css internet-explorer-8


【解决方案1】:

纯 CSS 解决方案不可能,您正在处理的浏览器太旧了。从好的方面来说,您不需要自己的脚本,因为 Selectivzr 就是这样做的,或者是 IE9.js 的一体化解决方案(修复了大量其他 IE 错误,而不仅仅是添加新的选择器)。

【讨论】:

  • IE9.js 适合我!谢谢
  • 我很高兴))))
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-09-26
  • 2021-12-10
  • 2014-04-07
  • 2012-01-19
  • 1970-01-01
  • 1970-01-01
  • 2013-05-28
相关资源
最近更新 更多