Skip to content

Commit 2f736d3

Browse files
committed
Fix mobile overflow with viewport width units
- Use 100vw for snippets-container to constrain to viewport width - Calculate max-width for snippet boxes: calc(100vw - 2rem) - Calculate max-width for code blocks: calc(100vw - 4rem) - Ensure content never overflows even on very small screens (< 590px)
1 parent 5a747fc commit 2f736d3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

public/styles.css

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,19 @@ pre.relative {
152152
}
153153

154154
/* Mobile responsive snippet styles */
155+
#snippets-container {
156+
max-width: 100vw;
157+
width: 100vw;
158+
box-sizing: border-box;
159+
}
160+
155161
#snippets-container > div {
156-
max-width: 100%;
162+
max-width: calc(100vw - 2rem); /* Account for container padding */
157163
box-sizing: border-box;
158164
}
159165

160166
#snippets-container pre {
161-
max-width: 100%;
167+
max-width: calc(100vw - 4rem); /* Account for container + snippet padding */
162168
box-sizing: border-box;
163169
}
164170

0 commit comments

Comments
 (0)