Skip to content

Commit 5c81e8b

Browse files
committed
Updated
1 parent f9b6e60 commit 5c81e8b

1 file changed

Lines changed: 24 additions & 41 deletions

File tree

assets/css/extended/custom.css

Lines changed: 24 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
/* 全局字体设置 */
1+
/* ==========================================
2+
全局字体设置
3+
========================================== */
24
body {
35
font-family:
46
"PingFang SC", /* macOS / iOS */
57
"Microsoft YaHei", /* Windows */
68
"Noto Sans SC", /* Android / Linux */
7-
sans-serif; /* 兜底字体 */
9+
sans-serif;
810
}
911

10-
/* 代码块保持等宽字体(可选) */
12+
/* 代码块保持等宽字体 */
1113
code, pre {
1214
font-family:
1315
"Fira Code",
@@ -16,60 +18,41 @@ code, pre {
1618
monospace;
1719
}
1820

19-
/* 针对手机屏幕调整基础字号 */
20-
@media (max-width: 720px) {
21+
/* ==========================================
22+
手机端适配:字号、标题、公式换行
23+
========================================== */
24+
@media (max-width: 768px) {
25+
/* --- 基础字号 --- */
2126
html {
22-
font-size: 14px; /* 默认是 16px 或 18px,你可以按喜好调整 */
27+
font-size: 14px;
2328
}
24-
/* 可选:让标题也相应小一点 */
2529
.post-title {
2630
font-size: 1.6rem;
2731
}
28-
}
29-
30-
/* ========== 移动端公式防溢出 ========== */
31-
@media (max-width: 768px) {
32-
33-
/* 1. 确保所有公式容器都能滚动 */
34-
.MathJax_Display,
35-
.MathJax {
36-
overflow-x: auto;
37-
overflow-y: hidden;
38-
max-width: 100%;
39-
-webkit-overflow-scrolling: touch; /* iOS 平滑滚动 */
40-
}
4132

42-
/* 2. 块级公式容器加一点内边距,防止滚动条遮挡 */
43-
.MathJax_Display {
44-
padding-bottom: 4px;
45-
}
46-
47-
/* 3. 允许行内公式在必要时换行 */
48-
/* 针对移动端强制 MathJax 行内公式换行 */
49-
@media screen and (max-width: 768px) {
50-
/* 目标:强制所有 MathJax 行内公式容器允许换行 */
51-
.post-content mjx-container {
33+
/* --- 行内公式换行(强力覆盖 MathJax 的 nowrap) --- */
34+
mjx-container {
5235
white-space: normal !important;
5336
}
54-
55-
/* 进阶:仅在必要时对公式内部元素断词,避免破坏结构 */
56-
.post-content mjx-container * {
37+
mjx-container * {
5738
word-break: break-word;
5839
overflow-wrap: break-word;
5940
}
60-
61-
/* 保留一个优雅的横向滚动方案,作为无法完美换行时的后备 */
62-
.post-content .MathJax_Display,
63-
.post-content mjx-container.MathJax_Display {
64-
overflow-x: auto;
41+
42+
/* --- 块级公式滚动(作为无法完美换行时的后备方案) --- */
43+
mjx-container[display="true"] {
44+
overflow-x: auto !important;
6545
overflow-y: hidden;
46+
max-width: 100% !important;
47+
-webkit-overflow-scrolling: touch;
48+
padding-bottom: 4px;
6649
}
67-
}
68-
/* 4. 最关键:限制所有父容器不允许溢出 */
50+
51+
/* --- 防止父容器撑出横向滚动条 --- */
6952
.post-content,
7053
.post-content p,
7154
.post-content div {
72-
overflow-x: clip; /* clip 比 hidden 更安全,不生成滚动条 */
55+
overflow-x: clip;
7356
max-width: 100%;
7457
}
7558
}

0 commit comments

Comments
 (0)