gpt4 book ai didi

css - 表内表,仅对外部应用 css

转载 作者:行者123 更新时间:2023-12-04 14:16:02 25 4
gpt4 key购买 nike

我有一个表格元素,它在一个单元格中也有一个表格。 (Jquery UI 日历其实在里面)

我怎样才能只设计父级?

body table tr td:nth-child(2n) {
background-color: red;
}

这样做:( fiddle here)

example

但我只想要 要选择的单元格(编号 2 和 5)。

最佳答案

使用 child ( > ) selector并在选择器中添加一个 tbody 元素(无需更改 HTML):

body > table > tbody > tr > td:nth-child(2n) {
background-color: red;
}

jsFiddle example

这是有效的,因为它专门只选择外部表。
在 Chrome、FF 和 IE 中测试成功。

关于css - 表内表,仅对外部应用 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25487258/

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