gpt4 book ai didi

css - 在一个选择器中选择除第一个和最后一个 td 元素之外的所有元素

转载 作者:技术小花猫 更新时间:2023-10-29 10:14:07 24 4
gpt4 key购买 nike

我在 CSS 中写了这样的东西:

tr.red > td:not(:last-of-type):not(:first-of-type)
{
color: #E53B2C;
border-bottom: 4px solid #E53B2C;
}

我正在尝试将此应用到表格单元格,这些单元格在 .red 类的行中不是第一个也不是最后一个。

它似乎按预期工作,但这真的是正确的方法吗?

最佳答案

也许这会有所帮助

tr.red  td:not(:first-child):not(:last-child)
{
//your styles
}

Sample

关于css - 在一个选择器中选择除第一个和最后一个 td 元素之外的所有元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13319334/

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