Alina Danila
Alina Danila

Reputation: 1683

CSS select element within multiple imbricated classes

I have a html page that contains a structure like this:

<table class="pick">
    <tr>
        <td>
            <div class="class1">
                <div class="class2">
                    <div class="myClass"></div>
                </div>
            </div>
        </td>
        <td>
            <div class="class1">
                    <div class="myClass"></div>
            </div>
        </td>
    </tr>
</table>

how can I select the elements that are inside the element with myClass class which is inside the pick class, but the structure of the div elements is variable, as in the code example?

I probably need something like this: .pick .something_else .myClass { /*style*/ } but I don't know exactly what.

Upvotes: 3

Views: 1673

Answers (1)

Sotiris
Sotiris

Reputation: 40096

.pick .myClass { /* style */ } will do the job. There is no need to add all the classes till the one you wish to select.

Upvotes: 8

Related Questions