0
Hello !
For example if we applied some css style to a group of items, is it to possible to exclude one of item from those style?
3 Antworten
+ 7
You can use :nth-child(n) selector in css to apply style to specific items from group or exclude some items from group
Example code :
<div class="item">Include</div>
<div class="item">Exclude</div>
<div class="item">Include</div>
<!--So if you want to exclude 2nd child of class item then you can use this selector-->
<style>
.item:nth-child(1),
.item:nth-child(3){
color:white;
background:black;
}
</style>
For more information ℹ️:
[https://www.w3schools.com/cssref/sel_nth-child.asp]
+ 5
Have you tried using a class?
Or could you give a code example?
+ 3
You can use different kinds of selectors (id, element, etc)