Web Development

Poking at the CSS if() Function a Little More: Conditional Color Theming

Chrome 137 shipped the if() CSS function, so it’s totally possible we’ll see other browsers implement it, though it’s tough to know exactly when. Whatever the case, if() enables us to use values conditionally, which we can already do with queries and other functions (e.g., media queries and the light-dark() function), so I’m sure you’re […]

Poking at the CSS if() Function a Little More: Conditional Color Theming Read More »

A Better API for the Intersection and Mutation Observers

In a previous article, I showed you how to refactor the Resize Observer API into something way simpler to use: // From this const observer = new ResizeObserver(observerFn) function observerFn (entries) { for (let entry of entries) { // Do something with each entry } } const element = document.querySelector(‘#some-element’) observer.observe(element); // To this const

A Better API for the Intersection and Mutation Observers Read More »