W3C home > Mailing lists > Public > public-css-archive@w3.org > April 2020

[csswg-drafts] [css-selectors] Nearest descendant selector (#4940)

From: Radoslav Sharapanov via GitHub <sysbot+gh@w3.org>
Date: Fri, 10 Apr 2020 06:12:46 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-597716912-1586499164-sysbot+gh@w3.org>
radogado has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-selectors] Nearest descendant selector ==
Hello, I would like to have a selector for the closest child only, which isn't a direct descendant of the container. It is useful for a carousel with a child (e.g. holding controls) and nested carousels, which shouldn't inherit the styles of the topmost one, while allowing for extra wrappers or supporting cases where we don't fully control the HTML structure.

**.wrapper ^ .child** to select only the first **.child**:

```
<div class="wrapper">
    <div>
        <div class="child"> </div>
    </div>
    <div>
        <div>
            <div class="child"> </div>
        </div>
    </div>
</div>
```

This has been requested by others before on SO. Thanks.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4940 using your GitHub account
Received on Friday, 10 April 2020 06:12:48 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:04 UTC