Is there a way I can add pseudo class to parent element from nested child. USING CSS ONLY
Example: In .less file, this is what I have.
.collection {
// Some styling
.headingRow {
//Some styling
.heading{
//Some styling
// This is where i want it to add the styling for alternate .collection class
}
}
}
This is what I want as Output
.collection:nth-of-type(2n+1) .headingRow .heading
{
background-color: #7a003d;
}
.collection:nth-of-type(2n) .headingRow .heading
{
background-color: #322f31;
}
This is what I tried - Adding &
from .heading class, I can add a parent elemnt or class using something like
.collection {
// Some styling
.headingRow {
//Some styling
.heading{
div&
// This results in div.collection .headingRow .heading { }
}
}
}
Is there a way I can add Pseudo class to parent ancestor ?