I've been working on upping my CSS skills lately and came across of the question whether or not there are CSS parent sectors - and I haven't been able to figure this one out.
Anyone got some wisdom to impart?
I've been working on upping my CSS skills lately and came across of the question whether or not there are CSS parent sectors - and I haven't been able to figure this one out.
Anyone got some wisdom to impart?
For further actions, you may consider blocking this person and/or reporting abuse
swiftproxy -
doctorsfolk -
kjilko -
Hiredeveloper -
Top comments (2)
There isn't an explicit parent selector, but in the CSS selectors of level 4, it is defined the :has() pseudo-class which allows to select an element based on the selectors passed to the
:has()
. That would allow to select an element based on their children, providing a "parent" selector (e.g.div:has(> img)
would select the div that is a direct parent of an img)... Unfortunately, it is not supported by any browser at the moment.No, there is no CSS parent selector.
css-tricks.com/parent-selectors-in...