Is there a CSS parent selector

0 votes

How do I select the <li> element that is a direct parent of the anchor element?

As an example, my CSS would be something like this:

li < a.active {
    property: value;
}

Obviously, JavaScript can be used to accomplish this, but I'm expecting that CSS Level 2 has some sort of built-in workaround.

I can't relocate the active element to the li> element since the menu I'm trying to style is generated by a CMS (unless I theme the menu creation module, which I'd rather not do).

Jul 25, 2022 in CSS by Edureka
• 13,620 points

edited 4 days ago 6 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP