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
- Open source social media icons to download and use on website? [closed]
- How to make a monopoly board using css grid?
- What’s the difference between SCSS and Sass?
- How am I supposed to use index.html?
- Half circle with CSS (border, outline only)
- CSS calc width and height values
- Column order manipulation using col-lg-push and col-lg-pull in Twitter Bootstrap 3
- What is the difference among col-lg-*, col-md-* and col-sm-* in Bootstrap?
- Adding border to SVG image
- What does !important mean in CSS?
- Failed to load resource: the server responded with a status of 404 (Not Found)
- Random gradient background color
- How to horizontally center an element
- Center image using text-align center?
- Unblur content inside blurring background div
- How do I make a transparent border with CSS?
- Failed to load resource: the server responded with a status of 404 (Not Found)
- Failed to load resource: the server responded with a status of 404 (Not Found) css
- How to change CSS using jQuery?
- Set line spacing
- See answer keys in Google Form (quiz) source page?
- CSS Background Opacity [duplicate]
- Remove blue underline from link
- Angular: conditional class with *ngClass
- CSS Background Opacity [duplicate]
- Outline effect to text
- Customize Bootstrap checkboxes
- Making a
- Converts scss to css [closed]
- React.js inline style best practices [closed]
- Remove class using jQuery
- What is a user agent stylesheet?
- Using two CSS classes on one element
- What is the difference between CSS and SCSS?