From d02e1db018ad28c48c21bca87601a2941bf04566 Mon Sep 17 00:00:00 2001 From: Edric Li Date: Mon, 12 Jan 2026 22:10:17 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E4=BC=98=E5=8C=96=E6=BB=9A=E5=8A=A8?= =?UTF-8?q?=E6=9D=A1=E8=87=AA=E5=8A=A8=E9=9A=90=E8=97=8F=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 默认隐藏滚动条,悬停时显示 - 支持 Webkit (Chrome/Safari/Edge) 和 Firefox - 滚动条样式与暗色主题适配 --- frontend/src/style.css | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/frontend/src/style.css b/frontend/src/style.css index bd86ab6d..b3b492b9 100644 --- a/frontend/src/style.css +++ b/frontend/src/style.css @@ -19,7 +19,22 @@ @apply min-h-screen; } - /* 自定义滚动条 */ + /* 自定义滚动条 - 默认隐藏,悬停或滚动时显示 */ + * { + scrollbar-width: thin; + scrollbar-color: transparent transparent; + } + + *:hover, + *:focus-within { + scrollbar-color: rgba(156, 163, 175, 0.5) transparent; + } + + .dark *:hover, + .dark *:focus-within { + scrollbar-color: rgba(75, 85, 99, 0.5) transparent; + } + ::-webkit-scrollbar { @apply h-2 w-2; } @@ -29,10 +44,15 @@ } ::-webkit-scrollbar-thumb { - @apply rounded-full bg-gray-300 dark:bg-dark-600; + @apply rounded-full bg-transparent; + transition: background-color 0.2s ease; } - ::-webkit-scrollbar-thumb:hover { + *:hover::-webkit-scrollbar-thumb { + @apply bg-gray-300/50 dark:bg-dark-600/50; + } + + *:hover::-webkit-scrollbar-thumb:hover { @apply bg-gray-400 dark:bg-dark-500; }