【发布时间】:2012-02-09 01:54:58
【问题描述】:
我有一些 css 用于调整我的表中的东西。
这里是:
.editor td:first-child
{
width: 150px;
}
.editor td:last-child input,
.editor td:last-child textarea
{
width: 500px;
padding: 3px 5px 5px 5px;
border: 1px solid #CCC;
}
它适用于 Firefox、Safari 和 Chrome,但不适用于(目前)IE8。
我知道问题出在第一个孩子和最后一个孩子,但我不是专家。
知道如何解决吗?
PS:我在我的 html 文档顶部添加了<!doctype html>,但没有任何改变。
【问题讨论】:
-
IE8 不支持
:last-child(尽管我相信它确实支持:first-child,因为这是在CSS 2.1 规范中,而:last-child在CSS 3 中)。 -
也许我们可以通过选择除 :first-child 之外的所有其他 td 来欺骗?任何想法?所以我们可以同时选择...?
-
@Bronzato: "all other than :first-child" 与 ":last-child" 不同,除非你的表只有两列。
-
是的,我的表只包含两列:)
标签: css internet-explorer-8 css-selectors