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

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -