This question already has an answer here:
- Is there a “previous sibling” selector? 15 answers
- Is there a CSS parent selector? 31 answers
i want to select svg of particular div using css.
what i am trying to do? i have multiple child divs under one parent div with class "wrapper_div". now each child div will have a link and div. this div will have svg...
now i want to select that svg of a div that has span with class "badge".
Below is the html,
<div class="wrapper_div">
<div class="grid">
<div class="card">
<a href="link1">
<div>
<div class="image">
<div class="image1"></div>
</div>
</div>
</a>
<div class="card_bottom">
<div class="info"></div>
<button>
<svg class="svg_class"/>
</button>
</div>
</div>
<div class="card">
<a href="link2">
<div>
<div class="image">
<img src="somelink">
</div>
<span class="badge">constant name</span>
</div>
</a>
<div class="card_bottom">
<div class="info"></div>
<button>
<svg class="svg_class"/>
</button>
</div>
</div>
<div class="card">
<a href="link2">
<div>
<div class="image">
<img src="somelink">
</div>
</div>
</a>
<div class="card_bottom">
<div class="info"></div>
<button>
<svg class="svg_class"/>
</button>
</div>
</div>
</div>
</div>
I have tried using ".grid .card svg.svg_class:first_of_type
this will select first svg but i want svg of div that has span of class "badge". how can i do it.
Could someone help me with this. thanks.