tibbe09
KPCKevin Powell - Community
•Created by tibbe09 on 4/24/2024 in #front-end
CSS how to select first element of consecutive same elements
Thank you all for your help and special thanks to @Jochem after his comment I came up with this selectors for my use case
:nth-child(1 of p), :not(p) + p
I think this selectors will work for my use case and 'p' can also be replaced with a class12 replies
KPCKevin Powell - Community
•Created by tibbe09 on 4/24/2024 in #front-end
CSS how to select first element of consecutive same elements
First of all thanks for the help. I will try fiddling around with your suggestions. However the selector should not be related to the div since instead of div's it could be possible that there are other elements inbetween. I'd like to select each element (in this example p but it could also be something else or class related) that has no previous direct sibling of the same type or class...
12 replies