Let’s say I have the following <ul>
:
<ul> <li>Child</li> <li><span class="active">Child</span></li> <li>Child</li> </ul>
Is it possible for me to change the style of the <li>
via the active
<span>
?
E.g.:
.active:parent(li) { background-color: red; }
I’ve been able to achieve this with jQuery, but it flickers on the screen for a split second (waiting for the DOM to load) and I want to avoid that.
Related Posts:
- not:first-child selector
- CSS selectors ul li a {…} vs ul > li > a {…}
- Is there a CSS selector for elements containing certain text?
- CSS reset – What exactly does it do?
- When to use margin vs padding in CSS [closed]
- SVG center horizontal and vertical line
- Can I change Bootstrap button color?
- Is it bad practice to comment out single lines of CSS with //?
- How to draw a half circle (border, outline only) [closed]
- CSS Circle with border
- Is there a CSS parent selector?
- What is the proper way to display a logo with CSS?
- Responsive font size in CSS
- How to make a vertical line in HTML
- CSS Font Border?
- How do I change the background color with JavaScript?
- Why em instead of px?
- Vertical Align Center in Bootstrap
- Button Center CSS
- Centering a background image, using CSS
- How to change the cursor into a hand when a user hovers over a list item?
- Nesting CSS classes
- CSS: center element within a element
- What is the difference between the selectors “.class.class” and “.class .class”?
- what is a parse error and how do I fix it
- How to use css first-child with :not()
- Bootstrap NavBar with left, center or right aligned items
- How to make the overflow CSS property work with hidden as value
- In CSS what is the difference between “.” and “#” when declaring a set of styles? [duplicate]
- How to make a sticky footer in react?
- How to push a footer to the bottom of page when content is short or missing?
- Linking to a pdf file with html
- Can I add background color only for padding?
- Change TD border color with HTML or CSS
- Why adding version number to CSS file path?
- Hide text using css
- Changing the width of Bootstrap popover
- CSS background color not working
- What does “*” mean in CSS?
- What does an asterisk (*) do in a CSS selector?
- Is there an opposite CSS pseudo-class to :hover?
- Bootstrap transparent navbar
- jQuery toggle CSS?
- How to get CSS to select ID that begins with a string (not in Javascript)?
- 100% DIV width is not really 100%
- CSS 3 slide-in from left transition
- Combine :after with :hover
- Bootstrap scrollable panel
- CSS checkbox input styling
- What does the “~” (tilde/squiggle/twiddle) CSS selector mean?
- How to place two divs next to each other?
- Background color in input and text fields
- CSS3 opacity gradient?
- Is there a “previous sibling” selector?
- How to exclude particular class name in CSS selector?
- CSS3 background image transition
- How can I apply styles to multiple classes at once?
- How to import Google Web Font in CSS file?
- CSS Equivalent of the “if” statement
- Specify multiple attribute selectors in CSS
- Can I apply a CSS style to an element name?
- CSS “and” and “or”
- CSS selector for first element with class
- How to select label for=”XYZ” in CSS?
- How to make div background color transparent in CSS
- WordPress Neve theme – main navigation css
- How to stick text to the bottom of the page?
- How to make blinking/flashing text with CSS 3
- Bootstrap align navbar items to the right
- Why is jquery show() not working in example
- Flex align-items: center not centering items
- Positioning
element at center of screen- How to set two different themes on one WordPress? (Desktop vs. Mobile)
- WordPress – https : Css and Js files are not working (load on http instead of https)
- Adding dashicon fonts to the admin of pre 3.8 installs
- Theme Check errors about missing CSS rules
- php syntax – how to concatenate properly – echo bloginfo(‘stylesheet_directory)
- Font Awesome wp_enqueue_style
- Do I need to register my own created .js and .css files
- X-Axis of Site is Messed Up Because it is in Hebrew
- Fixed layout for admin section
- Certain aspects of site suddenly not working in Chrome and Firefox
- CSS – why does my sidebar drops to the bottom of the page? [closed]
- why can’t i add front.css to my frontpage.php
- One Site. One Theme. Multiple Stylesheets without plugins?
- Assign Custom classes to every Excerpt
- is there a way to get all queued scripts/styles into a template without `get_header()`?
- How to Remove Active css from woocommerce variation?
- How to display 2 products per row for Mobile using WooCommerce?
- How do I move my logo from the center to left (Pixgraphy theme)
- jQuery function not working in WordPress but works in jsfiddle
- how to add custom css at top above all css file for specific url
- Setting up Custom Background [closed]
- Customiser colour picker and best practice for updating css
- How to add meta fields to custom taxonomy add/edit page?
- Load specific js & css based on class or ID?
- Add HTML input tag to to site navigation
- How to change first letter of active menu item
- How customizable is a self-hosted WordPress blog compared to a Blogger blog?
- Site navigation sits unstyled for a second on page reload [closed]