Is there a CSS parent selector? -


how select <li> element direct parent of anchor element?

in example css this:

li < a.active {     property: value; } 

obviously there ways of doing javascript i'm hoping there sort of workaround exists native css level 2.

the menu trying style being spewed out cms can't move active element <li> element... (unless theme menu creation module i'd rather not do).

any ideas?

there no way select parent of element in css.

if there way it, in either of current css selectors specs:

in meantime, you'll have resort javascript if need select parent element.


the selectors level 4 working draft includes :has() pseudo-class works same jquery implementation. of april 2017, this still not supported browser.

using :has() original question solved this:

li:has(> a.active) { /* styles apply li tag */ } 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -