From 10ba755a71bea18650404c1f79c52cbbd7f53a9d Mon Sep 17 00:00:00 2001 From: ClovertaTheTrilobita Date: Wed, 25 Mar 2026 20:51:38 +0200 Subject: [PATCH] fixed navbar and banner --- src/components/Header.astro | 24 ++++++-- src/components/Navigation.astro | 102 +++++++++++++++++++++++++++++--- 2 files changed, 113 insertions(+), 13 deletions(-) diff --git a/src/components/Header.astro b/src/components/Header.astro index ffe096a..4a458c0 100644 --- a/src/components/Header.astro +++ b/src/components/Header.astro @@ -24,6 +24,7 @@ const t = getTranslations(lang); .header-nav h1 a { color: inherit; text-decoration: none; + display: block; } .site-header { @@ -31,14 +32,11 @@ const t = getTranslations(lang); padding-top: 0.5rem; } - .site-header .header-nav h1 { - font-size: 2.5rem; - } - .theme-icon-wrap { position: absolute; top: 0; right: 0; + z-index: 2; } .header-nav { @@ -50,5 +48,23 @@ const t = getTranslations(lang); .header-nav h1 { margin: 0; font-style: italic; + line-height: 1.1; + + /* 给右上角 ThemeIcon 留空间 */ + max-width: calc(100% - 4rem); + + /* 桌面正常,手机自动缩小 */ + font-size: clamp(1.6rem, 6vw, 2.5rem); + } + + @media (max-width: 768px) { + .site-header { + padding-top: 0.25rem; + } + + .header-nav h1 { + max-width: calc(100% - 3.5rem); + font-size: clamp(1.25rem, 7vw, 2rem); + } } diff --git a/src/components/Navigation.astro b/src/components/Navigation.astro index b978f2d..73050ca 100644 --- a/src/components/Navigation.astro +++ b/src/components/Navigation.astro @@ -5,19 +5,29 @@ const lang = getLangFromUrl(Astro.url); const t = getTranslations(lang); --- -