Skip to content

Commit 817e23c

Browse files
committed
Website: add spacing on sides for small screens
1 parent 9739263 commit 817e23c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

website/public/main.css

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ body {
66
margin-left: auto;
77
margin-right: auto;
88
max-width: 45rem;
9+
padding-left: .5rem;
10+
padding-right: .5rem;
911
}
1012

1113
figure {
@@ -113,12 +115,14 @@ main > h2:first-child {
113115
}
114116

115117
/* Side-bar navigation, if the viewport is wide enough. */
116-
/* HACK(strager): max-width in this query should equal body's max-width, but we
117-
need to add a little bit in case of a scroll bar. */
118+
/* HACK(strager): max-width in this query should equal body's max-width (plus
119+
padding-left and padding-right), but we need to add a little bit in case of a
120+
scroll bar. 1em seems to be enough. */
118121
@media only screen and (min-width: 51em) {
119122
body.side-bar-nav {
120-
max-width: 50em;
123+
--page-width: 49em;
121124
--side-bar-width: 7rem;
125+
max-width: var(--page-width);
122126
}
123127

124128
/* Move the main content to the right to make room for the side bar. */
@@ -164,7 +168,7 @@ main > h2:first-child {
164168
overflow-y: auto;
165169
position: fixed;
166170
top: 0;
167-
width: calc((100% - 50em) / 2 + var(--side-bar-width));
171+
width: calc((100% - var(--page-width)) / 2 + var(--side-bar-width));
168172
}
169173

170174
.side-bar-nav header nav {

0 commit comments

Comments
 (0)