0

I am trying to apply a class to an element based on parent width. I tried the approach mentioned here but it didn't work.

<div>
      <div className="test-border">test</div>
    </div>

.test-red[min-width~="10px"] {
  background-color: rgb(247, 0, 0);
}

So what I tried to achieve there is to make the background red if the parent element width is > 10 px.
But, this seems to have no impact whatsoever.


NOTE: There are similar questions but none of them provide satisfying answers.

AG_HIHI
  • 1,432
  • 2
  • 19
  • 35
  • This should not have been marked as duplicate IMHO. This is about elementQuery. @AG_HIHI - Did you notice the JS external scripts in the codepen? [jQuery](https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js) and [elementQuery.js](https://tysonmatanich.github.io/elementQuery/elementQuery.min.js). – Rob Moll Sep 09 '21 at 13:59

0 Answers0