Commit 614576d
committed
contain code-block overflow with bordered horizontal scroll on mobile
Long code lines can overflow narrow screens and trigger horizontal page scrolling.
For code, wrapping/breaking tokens is undesirable because it hurts copy/paste and
readability fidelity.
Style `pre` as an explicit container (background, border, radius, padding) and
enable `overflow-x: auto` so overflow is contained inside the code block instead
of the page.
The container styling, especially the border, is intentional and important: it
makes the block read as a distinct container, which makes it easier to recognize
when it is scrollable.
Style inline `code` to match the visual language, and reset `pre code` background
and padding so nested code does not get double styling.
Result: on mobile, overflowing code stays unbroken and scrolls within a clearly
visible bounded container; on desktop, behavior remains normal when no overflow occurs.1 parent d36a799 commit 614576d
1 file changed
+16
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
30 | 46 | | |
31 | 47 | | |
32 | 48 | | |
| |||
0 commit comments