css selector for parent element

علی ذوالفقار
1401/10/05 18:37:06 (17)
there is no css selector for parent element
but we can use has() selector to add style to parent element : 
[i just check in chrome browser]

add style to outer span based on child span

< span >
    this is < span class="innerSpan" >test< /span> sample
< /span>

css : 
span:has(> span.innerSpan){
    background-color:green;
}	
Back