From 8d862e3a1140d0dca139375efe68637673b935ad Mon Sep 17 00:00:00 2001 From: yiqiu Date: Wed, 17 Dec 2025 17:41:27 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B4=A7=E6=80=A5=E4=BF=AE=E5=A4=8D=EF=BC=9A?= =?UTF-8?q?=E4=B8=BA=20nav-right=20=E6=B7=BB=E5=8A=A0=20flex-shrink=20?= =?UTF-8?q?=E5=92=8C=20min-height=20=E9=98=B2=E6=AD=A2=E9=AB=98=E5=BA=A6?= =?UTF-8?q?=E5=9D=8D=E5=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 问题根源: - 虽然设置了 align-items: stretch 和 height: 100%,但 nav-right 仍被计算为 0px - 原因是 flex 容器中的 nav-right 被隐式设置为 flex-shrink: 1(默认值),导致在计算时被压缩 - 同时缺少 min-height 导致可能的进一步坍塌 关键修复属性: - flex-shrink: 0 - 防止 flex 项在 nav-header 中被压缩 - min-height: 50px/48px/44px - 设置明确的最小高度作为备份(对应各断点的 nav-header 高度) 修改范围: 767px 断点(common.css + index.css): - .nav-header .nav-right 添加 flex-shrink: 0; min-height: 50px; - .nav-right 添加 flex-shrink: 0; min-height: 50px; 575px 断点(common.css + index.css): - 同上,但 min-height: 48px 360px 断点(index.css): - 同上,但 min-height: 44px 基础规则保持不变 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- common/common.css | 14 ++++++++++++-- css/index.css | 12 ++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/common/common.css b/common/common.css index 036b4e0..0c2d1a7 100644 --- a/common/common.css +++ b/common/common.css @@ -1295,24 +1295,29 @@ padding: 0 12px; display: flex !important; align-items: stretch !important; + justify-content: space-between !important; } .nav-header .nav-left { display: flex !important; align-items: stretch !important; - flex: 1; + flex: 0 1 auto; } .nav-header .nav-right { display: flex !important; align-items: stretch !important; height: 100% !important; + flex-shrink: 0; + min-height: 50px; } .nav-right { display: flex !important; align-items: stretch !important; height: 100% !important; + flex-shrink: 0; + min-height: 50px; } .nav-header .nav-left .nav-icon img { @@ -1513,24 +1518,29 @@ padding: 0 10px; display: flex !important; align-items: stretch !important; + justify-content: space-between !important; } .nav-header .nav-left { display: flex !important; align-items: stretch !important; - flex: 1; + flex: 0 1 auto; } .nav-header .nav-right { display: flex !important; align-items: stretch !important; height: 100% !important; + flex-shrink: 0; + min-height: 48px; } .nav-right { display: flex !important; align-items: stretch !important; height: 100% !important; + flex-shrink: 0; + min-height: 48px; } .nav-header .nav-left .nav-icon img { diff --git a/css/index.css b/css/index.css index 48fc5f0..8b37c39 100644 --- a/css/index.css +++ b/css/index.css @@ -2500,6 +2500,8 @@ html { align-items: stretch !important; height: 100% !important; flex-wrap: nowrap !important; + flex-shrink: 0; + min-height: 50px; } #index .nav-menu { @@ -2524,6 +2526,8 @@ html { justify-content: flex-end; gap: 6px; height: 100% !important; + flex-shrink: 0; + min-height: 50px; } #index .nav-right .nav-text-link { @@ -3064,6 +3068,8 @@ html { display: flex !important; align-items: stretch !important; height: 100% !important; + flex-shrink: 0; + min-height: 48px; } #index .nav-header .nav-left .nav-icon { @@ -3083,6 +3089,8 @@ html { justify-content: flex-end; gap: 4px; height: 100% !important; + flex-shrink: 0; + min-height: 48px; } #index .nav-right .nav-text-link { @@ -3568,6 +3576,8 @@ html { display: flex !important; align-items: stretch !important; height: 100% !important; + flex-shrink: 0; + min-height: 44px; } #index .nav-header .nav-left .nav-icon { @@ -3595,6 +3605,8 @@ html { justify-content: flex-end; gap: 4px; height: 100% !important; + flex-shrink: 0; + min-height: 44px; } /* 移动端隐藏登录按钮和分隔符,只显示注册按钮 */