Skip to content

Commit 1c15385

Browse files
committed
Proper responsive layout for mobile and many other CSS improvements
1 parent 9a04fd8 commit 1c15385

File tree

2 files changed

+71
-47
lines changed

2 files changed

+71
-47
lines changed

_includes/header.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<link rel="shortcut icon" href="/favicon.ico">
2424
<link rel="icon" href="/assets/images/favicon.png" type="image/png">
2525
<meta name="theme-color" content="#ff4848">
26-
<meta name="viewport" content="width=768" />
26+
<meta name="viewport" content="width=device-width, initial-scale=1" />
2727
<!--[if !IE]><!-->
2828
<link rel="stylesheet" href="/assets/css/style.css" media="screen">
2929
<link rel="stylesheet" href="/assets/css/style-print.css" media="print">

assets/css/style.css

Lines changed: 70 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@ body {
1010
background-repeat: repeat-x;
1111
margin: 0 auto;
1212
max-width: 67rem;
13+
font-size: 16px;
1314
display: grid;
1415
grid-template-areas: "head head nav"
1516
"hero hero hero"
1617
"main main main"
17-
"about about about"
1818
"foot foot foot";
19-
grid-template-rows: auto 1fr auto auto 70px;
19+
grid-template-rows: auto 1fr auto 70px;
2020
/*animation: backgroundScroll 80s linear infinite;*/ /* fancy but lots of CPU usage! */
2121
}
2222
@media (max-width: 768px) {
2323
body {
24-
grid-template-rows: auto auto 1fr auto auto 70px;
24+
font-size: 14px;
25+
grid-template-rows: auto auto 1fr auto 70px;
2526
grid-template-areas: "head head head"
2627
"nav nav nav"
2728
"hero hero hero"
2829
"main main main"
29-
"about about about"
3030
"foot foot foot";
3131
}
3232
}
@@ -39,57 +39,57 @@ body {
3939
body > header {
4040
/* background-color: #8ca0ff; */
4141
grid-area: head;
42-
padding: 30pt 30pt;
42+
padding: 40px;
43+
display: flex;
44+
align-items: center;
4345
}
4446
body > nav {
4547
/* background-color: #ffa08c; */
4648
grid-area: nav;
4749
display: flex;
4850
align-items: center;
4951
justify-content: right;
50-
font-size: 15pt;
51-
padding: 30pt 30pt;
52-
}
53-
body > nav > a {
54-
margin: 0 20pt;
52+
column-gap: 50px;
53+
font-size: 20px;
54+
padding: 40px;
5555
}
5656
@media (max-width: 768px) {
5757
body > header {
58+
max-width: 100%;
59+
padding: 15px 0px 15px;
60+
justify-content: center;
61+
}
62+
body > header > a {
5863
text-align: center;
5964
}
60-
body > header > img {
61-
max-width: 100%;
62-
width: auto;
63-
height: auto;
65+
body > header > a > img {
66+
max-width: 80%;
6467
}
6568
body > nav {
69+
max-width: 100%;
6670
justify-content: center;
67-
font-size: 25pt;
71+
column-gap: 25px;
72+
padding: 0 15px 15px;
73+
}
74+
body > nav > a {
75+
font-size: min(20px, 4.5vw);
6876
}
6977
}
7078

7179
body > hero {
7280
grid-area: hero;
7381
display: grid;
7482
align-items: center;
75-
column-gap: 40pt;
76-
padding: 40px;
83+
column-gap: 50px;
84+
padding: 0 40px 40px;
7785
}
7886

7987
body > main {
8088
grid-area: main;
8189
display: grid;
8290
align-items: center;
83-
column-gap: 40pt;
84-
padding: 40px;
85-
}
86-
body > #about {
87-
background-color: #0e305a;
88-
grid-area: about;
89-
display: flex;
90-
flex-direction: column;
91-
align-items: center;
92-
line-height: 18pt;
91+
column-gap: 50px;
92+
padding: 0 40px 40px;
9393
}
9494

9595
body > footer {
@@ -98,8 +98,9 @@ body > footer {
9898
display: flex;
9999
justify-content: center;
100100
align-items: center;
101+
text-align: center;
101102
color: #8c9dbb;
102-
font-size: 11pt;
103+
font-size: 0.9em;
103104
}
104105
body > footer > div > #reduced {
105106
display: none;
@@ -109,11 +110,8 @@ body > footer > div > #reduced {
109110
padding: 30px;
110111
}
111112
body > main {
112-
padding: 30px;
113-
}
114-
body > footer {
115-
padding: 50pt;
116-
font-size: 20pt;
113+
padding: 0 15px 15px;
114+
max-width: 100%;
117115
}
118116
}
119117

@@ -178,12 +176,23 @@ div#buildbins > p {
178176
p, ul, ol {
179177
margin: 0.65em 0;
180178
}
179+
li > ul, li > ol {
180+
margin-top: 0.325em;
181+
}
182+
@media (max-width: 768px) {
183+
ul {
184+
padding-left: 1em;
185+
}
186+
ol {
187+
padding-left: 2em;
188+
}
189+
}
181190
sup {
182191
font-size: x-small;
183192
}
184193
sup > a.footnote::before {
185194
content: "[";
186-
margin-left: 1pt;
195+
margin-left: 1.5px;
187196
}
188197
sup > a.footnote::after {
189198
content: "]";
@@ -219,6 +228,11 @@ hr {
219228
border-color: #808080;
220229
width: 100%;
221230
}
231+
@media (max-width: 768px) {
232+
h1 {
233+
font-size: 1.83em;
234+
}
235+
}
222236
h1.blogpost, h2, h3 {
223237
margin-bottom: 0.5em;
224238
}
@@ -235,16 +249,11 @@ span.emoji {
235249
Twitter Color Emoji; /* as of writing; Firefox provides and uses Twemoji Mozilla) */
236250
}
237251
div.scroll {
238-
max-height: 500px;
252+
max-height: min(500px, 67vh);
239253
padding-right: 1px; /* make border less ugly on Chrome on Windows */
254+
overflow-x: auto;
240255
overflow-y: scroll;
241256
}
242-
@media (max-width: 768px) {
243-
div.scroll {
244-
max-width: 100vh-60pt;
245-
overflow-x: scroll;
246-
}
247-
}
248257
table {
249258
border: 1px solid #808080;
250259
}
@@ -266,12 +275,27 @@ div.scroll > table > thead > tr > th {
266275
div.td2nowrap > table > tbody > tr > td:nth-child(2) {
267276
white-space: nowrap;
268277
}
269-
code {
270-
font-size: 11pt;
278+
code, div.highlight {
279+
font-size: 0.95em;
271280
background: #404040;
272-
border-radius: 3pt;
273-
padding-left: 3pt;
274-
padding-right: 3pt;
281+
}
282+
code {
283+
border-radius: 4px;
284+
padding: 0 4px;
285+
}
286+
div:has(div.highlight) {
287+
overflow-x: hidden;
288+
}
289+
div.highlight {
290+
overflow-x: auto;
291+
border-radius: 8px;
292+
}
293+
pre.highlight {
294+
margin: 0;
295+
padding: 6px 8px;
296+
}
297+
pre.highlight > code {
298+
padding: 0;
275299
}
276300
div.youtube {
277301
position: relative;

0 commit comments

Comments
 (0)