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?

23rd Aug 2022, 3:46 PM
Abdelghani Bensalih
Abdelghani Bensalih - avatar
3 Respostas
+ 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]
23rd Aug 2022, 5:34 PM
Sujal
Sujal - avatar
+ 5
Have you tried using a class? Or could you give a code example?
23rd Aug 2022, 3:51 PM
Lisa
Lisa - avatar
+ 3
You can use different kinds of selectors (id, element, etc)
23rd Aug 2022, 4:05 PM
Muhammad Ajmal P M
Muhammad Ajmal P M - avatar