首页›Eric Meyer›文章

To Infinity… But Not Beyond!

Eric Meyer · 2025年8月20日

AI 摘要 AI 生成,可能有误

作者继续试验在 calc() 函数中使用 CSS 的 infinity 关键字,这次将其应用于文本属性(text-indent、word-spacing、letter-spacing)、z-index 值和动画时长,并比较 Safari、Chrome 和 Firefox 三种浏览器的计算结果。测试显示,各浏览器之间的计算长度极不一致;而 z-index 则一律封顶于 2147483647——因此 calc(infinity + 1) 等于 infinity,甚至一个有限值也能与之打平或超越——而有限数除以 infinity 在所有三个浏览器中都一致地得出 0。将 animation-duration 设置为 calc(infinity * 1s) 会产生天文数字般漫长的时长(例如在 Firefox 中约为 10³¹ 年),并导致 Safari 页面失去响应,作者由此得出结论:浏览器将对 infinity 进行的任何算术运算都简单地视为返回 infinity。

Previously on meyerweb, I explored ways to do strange things with the infinity keyword in CSS calculation functions.  There were some great comments on that post, by the way; you should definitely go give them a read.  Anyway, in this post, I’ll be doing the same thing, but with different properties!

When last we met, I’d just finished up messing with font sizes and line heights, and that made me think about other text properties that accept lengths, like those that indent text or increase the space between words and letters.  You know, like these:

According to Frederic Goudy, I am now the sort of man who would steal a infinite number of sheep.  Which is untrue, because, I mean, where would I put them?

继续阅读全文

为了尊重作者,这里只展示开头几段。你可以去原文阅读,或者在 HorizonReader 里读:划线做笔记、让 AI 帮忙。

更多来自 Eric Meyer

My Interop 2027 Rankings

AI 摘要The author shares their personal rankings for Interop 2027 proposals using Jake Archibald's community ranking tool, placing JavaScript Temporal first, followed by improving CSS sibling-count()/sibling-index() interop, unprefixed CSS box-decoration-break, HTML headingoffset/headingreset attributes, and CSS line-clamp plus margin-trim. In total they ranked twenty proposals and explain their reasoning for each, while emphasizing these personal rankings do not predict how they will vote as Igalia's representative to Interop. They encourage readers to rank and share their own favorite proposals.

In situ Syntax Highlighting in macOS Applications Like Keynote

AI 摘要The author shares a macOS workflow for syntax-highlighting code blocks in place within Keynote (and other apps), built from the highlight command-line tool, a custom shell script, and an Automator Quick Action that adds an entry to the Services submenu of the right-click menu. The setup preserves the original font face and size, though line spacing is reset to 1.0 due to a limitation in highlight, and support for other languages can be added by duplicating the workflow and changing the syntax variable. Tested on macOS Sequoia, the approach has caveats such as failing on text with mixed fonts or sizes and performing no validation that the selected text matches the configured language.

Eighteen

AI 摘要The author reflects on what would have been his daughter Rebecca's eighteenth birthday, twelve years after her death, recalling her funeral and imagining the adulthood she never reached, including a high school graduation she likely would have had. He considers this transition from her 'phantom childhood' to 'phantom adulthood' as a possible turning point for the family, who have traditionally visited her grave together each year and are beginning to discuss loosening that ritual. This year, the family visited on the day itself, where a cellophane spinner cast glowing purple shapes—including a butterfly—across her name, a sight the Rebecca they knew would have loved.

Accessible (I Think) Split-Cell Table Headers

AI 摘要The author describes an attempt to build an accessible split-diagonal table header cell, inspired by Apollo 16 documentation, using rowspan on header cells (to satisfy WCAG 1.3.3), CSS positioning, and a gradient to draw the diagonal. He shares layout caveats, including a Safari bug with relative positioning on thead that required a workaround, and notes basic testing with accessibility experts found no major issues. He ultimately asks assistive technology users to confirm whether the solution actually works well for them.

Canvas-ing the Web

AI 摘要The author describes using Chrome's new flag-gated HTML-in-canvas API to add a one-click 'Download banner image' button to a browser-based tool built at Igalia for generating social media banners and thumbnails. They recount overcoming technical snags, including avoiding infinite recursion when inserting a custom element into a canvas (solved with Element.moveBefore() and connectedMoveCallback()) and dynamically resizing the canvas to fit its content. They conclude that while HTML-in-canvas excels for static screenshot-style use cases like theirs, the inherent mismatch between fluid DOM layout and fixed canvas dimensions will likely limit its broader adoption on the web.