0
div>input:not([disabled]) ~ label{
  color:green;
}

the above piece of code will target "child cousin" but I want to target the "parent cousin" element . >how can I achieve this using CSS.

<div>
  <input type="text">
  <input type="text" disabled>
  <label>child cousin</label>
</div>
<label>parent cousin</label>
  • I think you must consider rewriting your question properly – gpl Aug 20 '20 at 12:15
  • 1
    Does this answer your question? [Is there a CSS parent selector?](https://stackoverflow.com/questions/1014861/is-there-a-css-parent-selector) – Neil Aug 20 '20 at 12:22
  • it cannot be done with css - there is no parent selector – Pete Aug 20 '20 at 12:27

1 Answers1

-1

As stated here, the is still no parent selector using css, I suggest you use javascript for that.

Neil
  • 381
  • 2
  • 14