Questions tagged [parent-selector]

parent-selector is currently a CSS utopia of being able to write selectors where the parent's style depends on the child's style

CSS child selector is denoted with the > character. According to Shaun Inman, < is the desired syntax for parent selector. CSSv4 plans to add a :has pseudo-selector for parent selector.

10 questions
2
votes
1 answer

Will future versions of CSS support parent or ancestor selector?

Let us suppose that I have a theme where I am designing among others forms. Let us suppose further that the form might have a submit button of class .submit. There are cases when the button is disabled (the form is not ready for submission) and when…
Lajos Arpad
  • 64,414
  • 37
  • 100
  • 175
1
vote
1 answer

How can I use :has() parent-selector to select a child element of a parent on the condition there are not intermediaries between parent and child?

I am trying to do some fancy auto-color contrast correction work. I use Tailwind, and am trying to create some CSS rules that automatically change the color when the contrast is too low. Assume the following: .bg-white .text-white { color:…
Bryan Rayner
  • 4,172
  • 4
  • 26
  • 38
1
vote
0 answers

Bootstrap NavDropdown ClassName active not existent, how to know when dropdown elements are selected?

I am kind of stuck with a problem on react js. I am using the bootstrap library: https://react-bootstrap.github.io/components/navbar/ The home button is a , and that is why, I am able to give it a class name "active" when it is active,…
GSini
  • 11
  • 1
1
vote
0 answers

Add css rule to parent only if child does not have a particular attribute without using jquery

I want to add some css rule to parent if their is no child with particular attribute without using jquery.
HJain
  • 85
  • 8
0
votes
3 answers

Automatically repair bad contrast in Tailwind

I have a problem I need to solve with CSS selectors. I am trying to make automatic color overrides for Tailwind to have our site always comply to WCAG guidelines. I have a tailwind plugin I've written which automatically fixes this problem - but…
Bryan Rayner
  • 4,172
  • 4
  • 26
  • 38
0
votes
1 answer

sass- how to extend a parent selector inside a parent selector

I am trying to extend a parent selector and I do not seam to get it right .dashboard { &-left { display: inline-block; min-height: 100vh; height: 100%; width: 280px; border-right: 1px solid $gray3; } &-tabs-buttons { …
Maya
  • 3
  • 1
0
votes
1 answer

How can I apply styles to an ancestor using scss? Only if the ancestor has x element/class?

If a .page-builder__item--text has a table in it I want it to take on x styles. From reading the sass-lang docs I've got this but this doesn't seem to work. Have I misunderstood the docs? If so how? Note: I can't change the html table { …
DumbDevGirl42069
  • 891
  • 5
  • 18
  • 47
0
votes
1 answer

Why isn't Shopify compiling my SASS parent selector?

I'm trying to style a label that has a checkbox inside of it. I want the label to change color when the checkbox is selected. Using SASS and the ampersand, this should be possible with: input { …
Michael Lynch
  • 2,682
  • 3
  • 31
  • 59
-1
votes
3 answers

How to fetch div value with specific id using Jquery?

I have list of data with add button . On button click how to get value of div with id="rnumber" with jquery .i want number on button click. i don't know how to get that number i try but every time i get first number of list i want number of same…