开发者

Use selector to get the inner child [duplicate]

This question already has answers here: 开发者_StackOverflow中文版 Select deepest child in jQuery (7 answers) Closed 7 years ago.

Is there a way to select the inner child (deepest) using css selectors. Se example below:

<div class='d1 view'>
    <div class='d2 view'>
        <div class='d3 view'></div>
    </div>
    <div class='d4 view'>
        <div class='d5 view'>
            <div class='d6 view'></div>
        </div>
    </div>
</div>

The d1-d6 classes is just for simplifying my question.

I now want to select d3 and d6.

Note the list of children can be infinite. So is there a way to select - using css selectors - the deepest child?

I made a JSFiddle using jQuery


Currently with CSS there is no way to select the deepest child of a parent element. You'll have to resort to jQuery to solve this.

There are a couple of questions that cover this already.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜