Skip to content

Commit 7de16d2

Browse files
committed
Style page and mobile layout adjustments
1 parent 56894f2 commit 7de16d2

1 file changed

Lines changed: 109 additions & 15 deletions

File tree

Wireframe/style.css

Lines changed: 109 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,43 +17,97 @@ As well as useful links to learn more */
1717
https://scrimba.com/learn-css-variables-c026
1818
====== Design Palette ====== */
1919
:root {
20-
--paper: oklch(7 0 0);
21-
--ink: color-mix(in oklab, var(--color) 5%, black);
22-
--font: 100%/1.5 system-ui;
23-
--space: clamp(6px, 6px + 2vw, 15px);
24-
--line: 1px solid;
25-
--container: 1280px;
20+
--paper: white;
21+
--ink: black;
22+
--muted: #555555;
23+
--font: 100%/1.5 Arial, Helvetica, sans-serif;
24+
--space: clamp(10px, 10px + 2vw, 18px);
25+
--line: 2px solid black;
26+
--container: 1000px;
2627
}
28+
2729
/* ====== Base Elements ======
2830
General rules for basic HTML elements in any context */
31+
* {
32+
box-sizing: border-box;
33+
}
34+
2935
body {
36+
margin: 0;
37+
padding-bottom: 90px;
3038
background: var(--paper);
3139
color: var(--ink);
3240
font: var(--font);
3341
}
42+
3443
a {
35-
padding: var(--space);
44+
display: inline-block;
45+
padding: 10px 16px;
3646
border: var(--line);
47+
color: var(--ink);
48+
font-weight: bold;
49+
text-decoration: none;
3750
max-width: fit-content;
3851
}
52+
53+
a:hover {
54+
background: var(--ink);
55+
color: var(--paper);
56+
}
57+
3958
img,
4059
svg {
60+
display: block;
4161
width: 100%;
62+
height: 240px;
4263
object-fit: cover;
64+
border-bottom: var(--line);
4365
}
66+
4467
/* ====== Site Layout ======
4568
Setting the overall rules for page regions
4669
https://www.w3.org/WAI/tutorials/page-structure/regions/
4770
*/
71+
header {
72+
max-width: var(--container);
73+
margin: 40px auto 32px auto;
74+
padding: 0 var(--space);
75+
text-align: center;
76+
}
77+
78+
header h1 {
79+
margin: 0 0 8px;
80+
font-size: 2.5rem;
81+
}
82+
83+
header p {
84+
margin: 0;
85+
color: var(--muted);
86+
font-weight: bold;
87+
}
88+
4889
main {
4990
max-width: var(--container);
5091
margin: 0 auto calc(var(--space) * 4) auto;
92+
padding: 0 var(--space);
5193
}
94+
5295
footer {
5396
position: fixed;
5497
bottom: 0;
98+
left: 0;
99+
width: 100%;
100+
padding: 20px var(--space);
101+
border-top: var(--line);
102+
background: var(--paper);
55103
text-align: center;
56104
}
105+
106+
footer p {
107+
margin: 0;
108+
color: var(--muted);
109+
}
110+
57111
/* ====== Articles Grid Layout ====
58112
Setting the rules for how articles are placed in the main element.
59113
Inspect this in Devtools and click the "grid" button in the Elements view
@@ -65,25 +119,65 @@ main {
65119
display: grid;
66120
grid-template-columns: 1fr 1fr;
67121
gap: var(--space);
68-
> *:first-child {
69-
grid-column: span 2;
70-
}
71122
}
123+
124+
main > *:first-child {
125+
grid-column: span 2;
126+
}
127+
128+
main > *:first-child img {
129+
height: 320px;
130+
}
131+
72132
/* ====== Article Layout ======
73133
Setting the rules for how elements are placed in the article.
74134
Now laying out just the INSIDE of the repeated card/article design.
75135
Keeping things orderly and separate is the key to good, simple CSS.
76136
*/
77137
article {
78138
border: var(--line);
79-
padding-bottom: var(--space);
80139
text-align: left;
81140
display: grid;
82141
grid-template-columns: var(--space) 1fr var(--space);
83-
> * {
84-
grid-column: 2/3;
142+
}
143+
144+
article > * {
145+
grid-column: 2 / 3;
146+
}
147+
148+
article > img {
149+
grid-column: span 3;
150+
}
151+
152+
article h2 {
153+
margin: var(--space) 0 8px;
154+
}
155+
156+
article p {
157+
margin: 0 0 var(--space);
158+
color: var(--muted);
159+
}
160+
161+
article a {
162+
margin-bottom: var(--space);
163+
}
164+
165+
@media (max-width: 700px) {
166+
main {
167+
grid-template-columns: 1fr;
85168
}
86-
> img {
87-
grid-column: span 3;
169+
170+
main > *:first-child {
171+
grid-column: auto;
172+
}
173+
174+
img,
175+
svg,
176+
main > *:first-child img {
177+
height: 220px;
178+
}
179+
180+
header h1 {
181+
font-size: 2rem;
88182
}
89183
}

0 commit comments

Comments
 (0)