Skip to content

Commit 66d7337

Browse files
authored
Merge pull request #181 from DennisPitallano/fix/mobile-sticky-header
fix(mobile): sticky header, remove horizontal scrollbar, contain overflow
2 parents 55afa09 + 9c1f25e commit 66d7337

3 files changed

Lines changed: 20 additions & 5 deletions

File tree

‎css/base.css‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,22 @@
66
/* Modern reset (Josh Comeau-style, trimmed) ---------------------------- */
77
*, *::before, *::after { box-sizing: border-box; }
88
* { margin: 0; }
9-
html, body { height: 100%; }
9+
/* Note: no `height: 100%` on <body>. A fixed body height plus overflowing
10+
content breaks `position: sticky` on the header (body becomes the sticky
11+
containing block and its scroll port ends before the content does).
12+
`min-height: 100svh` below handles the "fill the viewport" case. */
13+
html { height: 100%; }
1014
html {
1115
-webkit-text-size-adjust: 100%;
1216
-webkit-tap-highlight-color: transparent;
1317
scroll-behavior: smooth;
1418
color-scheme: dark;
1519
font-feature-settings: "ss01", "cv11";
1620
background: var(--c-bg-0);
21+
/* Prevents horizontal scroll from decorative overflow (hero art rings,
22+
long no-wrap buttons) without creating a scroll container — required
23+
so `.nav { position: sticky }` keeps working on mobile. */
24+
overflow-x: clip;
1725
}
1826
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
1927

@@ -25,7 +33,6 @@ body {
2533
background: var(--c-bg-0);
2634
-webkit-font-smoothing: antialiased;
2735
text-rendering: optimizeLegibility;
28-
overflow-x: hidden;
2936
min-height: 100svh;
3037
}
3138

@@ -131,7 +138,7 @@ a:hover { color: var(--c-link-hover); }
131138
.container--wide { max-width: var(--container-w-wide); }
132139
.container--full { max-width: none; padding-inline: 0; }
133140

134-
section { position: relative; padding-block: var(--section-py); }
141+
section { position: relative; padding-block: var(--section-py); overflow-x: clip; }
135142
section + section::before {
136143
content: "";
137144
position: absolute;

‎css/components.css‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,19 @@
3333
border-color var(--d-2) var(--ease-out);
3434
box-shadow: 0 0 0 0 var(--btn-glow);
3535
white-space: nowrap;
36+
text-align: center;
37+
max-width: 100%;
3638
text-decoration: none;
3739
}
3840
.btn:hover { transform: translateY(-2px); box-shadow: 0 12px 32px var(--btn-glow); }
3941
.btn:active { transform: translateY(0); }
40-
.btn .fa, .btn svg { width: 1em; height: 1em; }
42+
.btn .fa, .btn svg { width: 1em; height: 1em; flex: none; }
43+
/* Allow long button labels to wrap on narrow viewports so they can't
44+
overflow the container (e.g. the "DigiByte Technical Architecture
45+
(White Paper)" ghost button on the DGB section). */
46+
@media (max-width: 560px) {
47+
.btn { white-space: normal; overflow-wrap: anywhere; }
48+
}
4149

4250
.btn--primary {
4351
--btn-bg: var(--g-button);

‎css/dgb.min.css‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)