From 54a94cace17329fce6b1d1a21b72a0e1f43f2110 Mon Sep 17 00:00:00 2001 From: "Harry C. Kepler" Date: Thu, 26 Nov 2026 18:28:20 +0100 Subject: [PATCH] fix(home): wrap hero text only between phrases on narrow screens MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On phones the hero sentences are wider than a line, so the browser broke them wherever it could: inside Chinese words (编程|语言, 易错|陷阱) and inside English phrases ("in a / new language", "quick / onboarding"). text-wrap: balance evens out line lengths but knows nothing about phrases. Wrap each phrase of the homepage h1 and description in an inline-block .phrase span so lines break only between phrases. Desktop layout is unchanged. Co-Authored-By: Claude Opus 5.5 --- src/pages/index.astro | 9 +++++---- src/pages/zh/index.astro | 9 +++++---- src/styles/global.css | 5 +++++ 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/pages/index.astro b/src/pages/index.astro index eb9c71b..bfb4968 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -36,13 +36,14 @@ sheets.sort((a, b) => {

- A lightweight 2026 quick reference
for developers coding in a new language. + A lightweight 2026 quick reference
+ for developers coding in a new language.

- Easy to read, clearly sectioned, and friendly to newcomers.
- Covers core syntax, common data structures, and gotchas, verified by real toolchains.
- Ideal for LeetCode practice, quick onboarding, or refreshing rusty syntax. + Easy to read, clearly sectioned, and friendly to newcomers.
+ Covers core syntax, common data structures, and gotchas, verified by real toolchains.
+ Ideal for LeetCode practice, quick onboarding, or refreshing rusty syntax.

diff --git a/src/pages/zh/index.astro b/src/pages/zh/index.astro index 4649046..db581ec 100644 --- a/src/pages/zh/index.astro +++ b/src/pages/zh/index.astro @@ -37,13 +37,14 @@ sheets.sort((a, b) => {

- 2026 主流编程语言轻量速查表
快速上手一门新语言 + 2026 主流编程语言轻量速查表
+ 快速上手一门新语言

- 轻量易读、章节清晰、新手友好。
- 专为 LeetCode 刷题、快速上手与语法拾遗设计。
- 覆盖核心语法、常用数据结构与易错陷阱。所有代码可直接运行验证。 + 轻量易读、章节清晰、新手友好。
+ 专为 LeetCode 刷题、快速上手与语法拾遗设计。
+ 覆盖核心语法、常用数据结构与易错陷阱。所有代码可直接运行验证。

diff --git a/src/styles/global.css b/src/styles/global.css index 6cc8856..2ec434f 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -1217,6 +1217,11 @@ html[data-theme="dark"] .shiki span { } } +/* Hero text wraps only between phrases, so narrow screens never split a word or phrase. */ +.phrase { + display: inline-block; +} + .index-grid-section { width: 100%; padding: 0;