Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67469

How to select svg related to a particular div using css? [duplicate]

$
0
0

This question already has an answer here:

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.


Viewing all articles
Browse latest Browse all 67469

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>