Jump to main content

Nicolas Hoizey

  • articles
  • billets
  • links
  • notes
  • talks
  • archives
  • about

Bramus Van Damme avatar Bramus Van Damme

Using :is() in complex selectors selects more than you might initially think

  • Nicolas Hoizey
  • 30 March 2023
  • CSS
  • 13 reactions
Screenshot of “Using :is() in complex selectors selects more than you might initially think”

https://www.bram.us/2023/01/17/using-is-in-complex-selectors-selects-more-than-you-might-initially-think/

While I wouldn’t write a selector like that myself, this is highly relevant because of CSS Nesting that is getting specified. There, the Nesting Selector (&) desugars to :is().

13 reactions

6 likes

  1. Mark Llobrera avatar
  2. tzi avatar
  3. Bramus avatar
  4. Fernando Mateus avatar
  5. RealET avatar
  6. Tyler Sticka avatar

4 reposts

  1. Bramus avatar
  2. Fronteers avatar
  3. Twidi / Stéphane Angel avatar
  4. RealET avatar

3 replies

  1. Wolfr avatar Wolfr
    @nhoizey @bramus is it me or does the demo select exactly the same and it's supposed to prove a point that it doesn't?
    • 1 April 2023, 01:22
    • Source
  2. Wolfr avatar Wolfr
    @nhoizey @bramus nevermind I get it now
    • 1 April 2023, 01:25
    • Source
  3. Timo Tijhof avatar Timo Tijhof
    @nhoizey @bramus The surprise with CSS :is() reminds me of the surprise in Elememt.querySelector. <div><p>
    <i>..</i>
    <div><i>..</i></div>
    </p></div>
    p = document.querySelector('div p');
    p.querySelectorAll('div i').length === 2Selectors are absolute, not relative. They match based on full identity. This unlike jQuery where $p.find('div i') is naturally scoped to the paragraph, looking only for descendant divs and italics. #css #jquery #webdevhttps://johnresig.com/blog/thoughts-on-queryselectorall/
    css…
    • 6 May 2023, 17:13
    • Source
  • Older: Sass and Native Nesting
  • Newer: On Container Queries, Responsive Images, and JPEG-XL

Related contents with similar topics

  1. screenshot of Our CSS isn’t opinionated enough

    Craig Abbott

    Our CSS isn’t opinionated enough

    • Nicolas Hoizey
    • 2 November 2026
    • CSS
    • 4 reactions

    We’ve built and pushed a “best practice” way of working where appearance and semantic meaning are completely decoupled. Then, we’re weirdly surprised…

  2. screenshot of A select should tell you something

    Ahmad El-Alfy

    A select should tell you something

    • Nicolas Hoizey
    • 2 November 2026
    • HTML, CSS, UX
    • 2 reactions

    We finally can style a select. The bigger change is what an option can hold. Until now, an option was one line of plain text, so everything a person…

  3. screenshot of Alignment in CSS Grid Lanes

    Patrick Brosset avatar Patrick Brosset

    Alignment in CSS Grid Lanes

    • Nicolas Hoizey
    • 13 October 2026
    • CSS, Grid Lanes
    • 5 reactions

    […] here is the really interesting part, aligning individual items along the stacking axis. At first sight, this might seem surprising. After all,…

  4. screenshot of Controlling when CSS custom property values are computed

    Jake Archibald avatar Jake Archibald

    Controlling when CSS custom property values are computed

    • Nicolas Hoizey
    • 15 September 2026
    • CSS
    • 2 reactions

    When and how CSS custom property values are calculated might not be what you expect, and it has a big impact on your styles.

  5. screenshot of Scroll-Driven Animations

    Josh W. Comeau avatar Josh W. Comeau

    Scroll-Driven Animations

    • Nicolas Hoizey
    • 30 April 2026
    • CSS, animations
    • 4 reactions

    The CSSWG deserves a lot of credit, in my opinion, for repurposing/extending CSS keyframe animations for scroll-driven animations. Rather than invent…

If you want to share an error or suggest an enhancement of this content, please edit the source on GitHub.

© Nicolas Hoizey

Built with Eleventy