cuốn sách gpt4 ai đã làm

html - 关于 :nth-child and :nth-of-type selectors

In lại Tác giả: Walker 123 更新时间:2023-11-28 17:02:27 25 4
mua khóa gpt4 Nike

遇到一个我想不通的问题。我正在尝试做的一个简单示例:

在类 .row 下第一个“跨度”的每次出现都以红色突出显示,除了第一次出现,它应该以黄色突出显示。

.row span:nth-of-type(1) {
nền: màu đỏ;
}

这可以通过 :con thứ n hoặc :nth-of-type 选择器来完成吗?如果不是,如何在不求助于内联样式的情况下做到这一点?

这是一个 fiddle :

https://jsfiddle.net/z9mho7p5/

Cảm ơn trước!

câu trả lời hay nhất

只是简单

 .row span:first-child
{
background-color:red;
}

.row:first-child span:first-child
{
background-color:yellow ! important;
}

关于html - 关于 :nth-child and :nth-of-type selectors,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30963367/

25 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress