From 71f796069f9078295b54e26d1f790bf38e087c6c Mon Sep 17 00:00:00 2001 From: yetone Date: Tue, 13 Oct 2026 18:27:04 +0800 Subject: [PATCH] site: the docs bar keeps every link on one line instead of stacking it a character per line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Between 1000px and ~1300px the docs nav's links shrank to fit, so 快速上手 and "Get started" wrapped into columns of characters and the bar grew two lines tall (owner's screenshot, zh docs). The links now never wrap inside themselves (white-space: nowrap), the brand keeps its width, and the link row is one 22px line: a link that doesn't fit wraps onto a second line the bar clips. This fits every language without a per-language breakpoint; the contents still list every page. Run: served site/public locally and shot /docs/{zh,en,ja}/start in headless Chrome at 1010, 1120, 1300 and 1500px: one line each, no clipped half-links, buttons untouched. node --test site/*.test.mjs passes. --- site/public/docs.css | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/site/public/docs.css b/site/public/docs.css index d2b622884..d11408586 100644 --- a/site/public/docs.css +++ b/site/public/docs.css @@ -63,11 +63,12 @@ code, pre, kbd, .mono { font-family: ui-monospace, "SF Mono", "JetBrains Mono", nav { position: sticky; top: 0; z-index: 10; backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); background: color-mix(in srgb, var(--bg) 78%, transparent); border-bottom: 1px solid var(--line); } nav .wrap { display: flex; align-items: center; gap: 14px; height: 60px; } -.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; font-size: 17px; letter-spacing: -.01em; text-decoration: none; } +.brand { flex: none; white-space: nowrap; display: flex; align-items: center; gap: 9px; font-weight: 650; font-size: 17px; letter-spacing: -.01em; text-decoration: none; } .brand img { width: 24px; height: 24px; } .brand small { font-weight: 500; color: var(--ink3); font-size: 15px; padding-left: 10px; margin-left: 2px; border-left: 1px solid var(--line); } -nav .links { display: flex; gap: 24px; margin-left: auto; margin-right: 10px; font-size: 14px; color: var(--ink2); } -nav .links a { text-decoration: none; } +/* one line only: a link that doesn't fit wraps onto a second line the bar clips, never into a column of characters */ +nav .links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 40px 24px; min-width: 0; height: 22px; line-height: 22px; overflow: hidden; margin-left: auto; margin-right: 10px; font-size: 14px; color: var(--ink2); } +nav .links a { text-decoration: none; white-space: nowrap; } nav .links a:hover { color: var(--ink); } /* listed in the contents (docs.js reads them from here) but kept out of the bar, which has no room */ nav .links a.toc-only { display: none; }