gpt4 book ai didi

html - 如何仅将 css 属性应用于我的第一个 div 类

转载 作者:太空宇宙 更新时间:2023-11-04 03:50:00 25 4
gpt4 key购买 nike

enter image description here我有两个 dhx_scroll_cont div 类,当我编写 css 代码时,它适用于两个类。现在我想写一个申请第一个div调用的css代码

.dhx_scroll_cont:before{
//some code here
}

最佳答案

Demo Fiddle

只需使用:

.dhx_scroll_cont:first-of-type:before{
//some code here
}

more on first-of-type

The :first-of-type CSS pseudo-class represents the first sibling of its type in the list of children of its parent element.


更新

根据 the screenshot the OP posted以下应该有效:

.dhx_view_day_events .dhx_scroll_cont:first-of-type:before{
//some code here
}

关于html - 如何仅将 css 属性应用于我的第一个 div 类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23544173/

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