This talk by Patrick Brosset is one of my favorite talks from this year’s CSS Day Conference. How do browsers actually recalculate styles when webpages change? Can the way you write CSS impact the speed of the recalculation process? In this talk, we’ll go through the details of how browser engines react to DOM changes …
Tag Archives: selectors
Using :is()
in complex selectors selects more than you might initially think
Sibling Scopes in CSS, thanks to :has()
and ~
CSS :has()
feature detection with @supports(selector(…))
: You want :has(+ *)
, not :has(*)
A :nth-child(An+B [of S]?)
polyfill thanks to CSS :has()
and :not()
Detect “islands of elements” with the same class, thanks to CSS :has()
Style a parent element based on its number of children using CSS :has()
A Previous Sibling Selector
Jim Nielsen set out to style a bunch of links that appeared before hr elements. As the element tree – generated from a Markdown file – was entirely flat, there are no enclosing section elements to hook onto in order to select those links (using something like section p:last-child a:only-child). The solution? The :has() selector: …
CSS: Select first x
items
Because I keep forgetting this, an entry on the blog so that my future self can find it back easily: CSS: Want your first 5 list items to be bold? li:nth-of-type(-n + 5) {font-weight: bold;} Start with the # of list items you want to impact, then increment backward with -n. — Estelle Weyl (@estellevw) …
Test your CSS Selector Skills with CSS Speedrun
Now that’s a fun little quiz by Vincent Will: A small fun app to test your CSS knowledge. Find the correct CSS selectors for the 10 puzzles as fast as possible. Finished my in 04:38:7. Level 8 tripped me up though: didn’t immediately see the pattern and lost more than 2 minutes on it 😅. …
Continue reading “Test your CSS Selector Skills with CSS Speedrun”