Home > Net >  Apply CSS to child when parent contains class
Apply CSS to child when parent contains class

Time:10-08

I can't seem to find a way to get CSS applied to a child element of a parent that has a dynamic class. See example. Is there any solution to this?

`https://jsfiddle.net/0yjn925g/`

CodePudding user response:

 

[class^="wrapper-"] .username {background: red;}
<div class="wrapper-">
  <input class="username" type="text"/>
</div>

<div class="wrapper-a1">
  <input class="username" type="text"/>
</div>

<div class="wrapper-a2">
  <input class="username" type="text"/>
</div>

  • Related