Skip to content

Commit b4667a2

Browse files
committed
Fix code block font size on mobile (too large)
Root cause: mobile Safari inflates text inside `pre` elements when content is wider than the viewport, overriding the computed font-size. The existing `text-size-adjust: 100%` on `html` does not propagate fully to `pre` elements with `overflow: auto`. Fix: - Add `-webkit-text-size-adjust: 100%` directly on pre/code/prism-code to prevent mobile Safari text inflation - Add mobile media query (max-width: 768px) reducing code block font to 12px for better visual proportion on small screens https://claude.ai/code/session_01UjvipgoS6qs1ikzifd77Xi
1 parent d06c79a commit b4667a2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/css/custom.css

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,19 @@
2424
--ifm-pre-line-height: 1.3;
2525
}
2626

27-
/* Code blocks: 14px font, normal line height */
27+
/* Code blocks: consistent font, prevent mobile Safari text inflation */
2828
pre, pre code, .prism-code {
2929
font-size: 14px !important;
3030
line-height: 1.5 !important;
31+
-webkit-text-size-adjust: 100%;
32+
text-size-adjust: 100%;
33+
}
34+
35+
/* Smaller code blocks on mobile for better readability */
36+
@media (max-width: 768px) {
37+
pre, pre code, .prism-code {
38+
font-size: 12px !important;
39+
}
3140
}
3241

3342
/* ASCII diagrams: no line gaps for proper character alignment */

0 commit comments

Comments
 (0)