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

Re: [csswg-drafts] [selectors] :visible pseudo-class for targeting only visible elements (#5827)

From: Chris Coyier via GitHub <sysbot+gh@w3.org>
Date: Tue, 29 Dec 2020 15:07:06 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-752112696-1609254425-sysbot+gh@w3.org>
My little case that (maybe?) triggered this.

Authored HTML:

```html
<div class="book">
   <img src="" alt="">
   ...
</div>
```

CSS:

```css
.book :first-child {
  /* size the image */
}
```

Production HTML:

```html
<div class="book">
   <script src="third-party-performance-thing.js"></script>
   <img src="" alt="">
   ...
</div>
```

So that CSS now fails because it's targeting the wrong thing. Obviously can be worked around, but this CSS might be more resilient?

```css
.book :first-child:visible {
  /* size the image */
}
```


-- 
GitHub Notification of comment by chriscoyier
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5827#issuecomment-752112696 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 29 December 2020 15:07:08 UTC

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