This article is a roundup of clever uses for the CSS :has selector, citing examples from developers like Jim Nielsen, Ahmad Shadeed, Bramus, Andy Bell, and Michelle Barker. Highlights include hiding page overflow when a dialog is open, styling elements based on their siblings or children, unsetting paragraph width constraints when they contain embedded content, and detecting invalid form inputs to trigger error states. The author finds these capabilities eye-opening and expects many more useful :has examples to emerge in the coming years.
I still haven’t used :has outside of little demos and screwing around in Codepen but there’s been a growing chorus over the last few months about all the tiny yet amazing things that :has can do for us.
A few years ago Ahmad Shadeed wrote the canonical post on all this stuff and showed the most common example right out the gate:
继续阅读全文
为了尊重作者,这里只展示开头几段。你可以去原文阅读,或者在 HorizonReader 里读:划线做笔记、让 AI 帮忙。
AI 摘要The article discusses Katherine Rundell's essay on why adults should read children's books, highlighting her quotation of Frances Spufford about the inherent power and danger of storytelling. Rundell argues that real fairytales are driven by hunger, contrasting the original Cinderella with Disney's passive version that lacks agency. The author connects this to their own childhood experience of devouring Animorphs books, noting they are still chasing that same fierce, transformative hunger for stories nearly thirty years later.
AI 摘要After receiving a box of embarrassing journals from his early twenties, the author finds a gentler perspective through Roland Allen's 'The Notebook: A History of Thinking on Paper,' which shows that recording quotes, sketches, and musings is part of an ancient tradition, exemplified by Dutch students' album amicorum in 1575. He realizes that journaling—and even blogging—is a centuries-old practice of curiosity and self-improvement practiced by sailors, da Vinci, and Venetian merchants alike. Ultimately, he concludes that people across the ages are fundamentally the same, all eager to record and share the things they love, 'Fight Club' included.
AI 摘要The article is an enthusiastic, spoiler-free recommendation of Claire Keegan's novella 'Small things like these', praising its sweet, triumphant, and satisfying ending that will stay with the reader. The author describes Keegan's writing as clear and precise, and quotes her explaining that she aims to work on the level of suggestion by removing traces of her labours and trusting the reader's intelligence.
AI 摘要The article reflects on Italo Calvino's 1967 lecture 'Cybernetics and Ghosts,' in which Calvino envisioned machines capable of writing poetry and novels and found comfort in the idea of literature being reduced to finite, systematic operations. The author admits to bristling at this reduction of the mysterious craft of novel-making and feeling a need to defend the humanities. Ultimately, however, Calvino offers a hopeful twist: machines could expose literature's rules so that writers can see them clearly, break them, and create something entirely new.
AI 摘要At SFO, the author encounters an exhibit called Indoor Eden: Victorian Jardinières, featuring an 1870 quote from Shirley Hibberd's gardening book urging readers not to despise 'the day of small things.' Though impressed by the craftsmanship of the Victorian art nouveau pottery, the author humorously vents about how profoundly ugly the pieces are, arguing that effort doesn't make something good. They conclude by jokingly rejecting Hibberd's gentle advice about making small improvements, grumpily insisting that small, ugly things should be unacceptable and fixed with dramatic, life-changing overhauls instead.