gpt4 book ai didi

css - 如何连续选择第一个和最后一个TD?

转载 作者:数据小太阳 更新时间:2023-10-29 09:05:42 24 4
gpt4 key购买 nike

如何选择一行中的第一个和最后一个 TD

tr > td[0],
tr > td[-1] {
/* styles */
}

最佳答案

您可以使用 :first-child:last-child 伪选择器:

tr td:first-child,
tr td:last-child {
/* styles */
}

这应该适用于所有主流浏览器,但 IE7 在动态添加元素时会出现一些问题(在 IE6 中不起作用)。

关于css - 如何连续选择第一个和最后一个TD?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7228800/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com