Select class where parent is last child in [duplicate]
This question already has an answer here: Why doesn’t nth-of-type/nth-child work on nested elements? (1 answer) Closed last month. I have a simple html hierarchy: <div> <div> <div class=”custom-class”>whatever</div> </div> <div> <div class=”custom-class”>whatever</div> </div> <div> <div class=”custom-class”>thing i want to select</div> </div> </div> I am currently adding attributes to .custom-class but would like to add […]
How to select a descendent of div.box-type-1, but only when div.box-type-1 is the closest ancestor with a .box-type-* class?
I’ve got containers with colored backgrounds that fall into one of three different categories, represented by the sass placeholders %dark-box
, %light-box
, and %gradient-box
. I need to adjust the styling of elements that are descendants of these boxes. These elements can be nested at any arbitrary depth within the box.
CSS/SCSS: How to select a descendent of div.box-type-1, but only when div.box-type-1 is the closest ancestor with a .box-type-* class?
I’ve got containers with colored backgrounds that fall into one of three different categories, represented by the sass placeholders %dark-box
, %light-box
, and %gradient-box
. I need to adjust the styling of elements that are descendants of these boxes. These elements can be nested at any arbitrary depth within the box.