字号调整

This commit is contained in:
fengxiangdebaozi committed 2026-06-01 22:17:39 +08:00
1 parent 0c5938a5a3
commit fa41d620fd
6 files changed
+68 -28

No files matched your search

+31
View File
@@ -820,3 +820,34 @@
border-color: var(--border);
outline-color: var(--ring);
}
/* ─── 全局字号缩放(只改字号,不动布局)──────────────────────────────────
* 用户在「设置 → 外观 → 字号」里选的倍数由 FontScaleApplier 写到
* <html> 的 `--ui-font-scale`(默认 1)。这里只把 Tailwind 的 `--text-*`
* 字号 token 乘以该倍数 —— 间距 token(--spacing)原样不动,所以 padding /
* margin / gap / 宽高这些布局尺寸不随字号变化,避免放大字体把页面挤错位。
* 行高用 Tailwind 默认的无单位比值,会跟随字号等比变化(文字不会重叠)。
* 不在 @layer 内,优先级高于 Tailwind 的主题层变量,确保覆盖生效。 */
:root {
--ui-font-scale: 1;
--text-xs: calc(0.75rem * var(--ui-font-scale, 1));
--text-sm: calc(0.875rem * var(--ui-font-scale, 1));
--text-base: calc(1rem * var(--ui-font-scale, 1));
--text-lg: calc(1.125rem * var(--ui-font-scale, 1));
--text-xl: calc(1.25rem * var(--ui-font-scale, 1));
--text-2xl: calc(1.5rem * var(--ui-font-scale, 1));
--text-3xl: calc(1.875rem * var(--ui-font-scale, 1));
--text-4xl: calc(2.25rem * var(--ui-font-scale, 1));
--text-5xl: calc(3rem * var(--ui-font-scale, 1));
--text-6xl: calc(3.75rem * var(--ui-font-scale, 1));
--text-7xl: calc(4.5rem * var(--ui-font-scale, 1));
--text-8xl: calc(6rem * var(--ui-font-scale, 1));
--text-9xl: calc(8rem * var(--ui-font-scale, 1));
}
/* 没有显式 text-* 类的元素(继承自 body 的默认正文)也跟随缩放。
* 只设 font-size,不影响任何盒模型尺寸。 */
body {
font-size: calc(1rem * var(--ui-font-scale, 1));
}