gpt4 book ai didi

html - 表类的第一个 child TD

转载 作者:行者123 更新时间:2023-11-28 04:49:54 25 4
gpt4 key购买 nike

我只想对具有特定类的 TABLE 的第一个 TD 应用一些样式。我正在使用:

.class td:first-child {
background-color: red;
}

但是如果有嵌套的 TD,它们也会被设置样式。

我如何才能将其仅应用于第一个 TD?

See JSfiddle here (我希望test1变红,但test4不行)

最佳答案

除非您想使用类或其他东西,否则您可以使用直接子选择器:

.pretty > tbody > tr > td:first-child {
background-color: red;
}

关于html - 表类的第一个 child TD,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34998117/

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