Skip to content

Commit 2e3ad69

Browse files
committed
Center the head of the webpage
1 parent 8e7f012 commit 2e3ad69

1 file changed

Lines changed: 39 additions & 46 deletions

File tree

Wireframe/style.css

Lines changed: 39 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,4 @@
1-
/* Here are some starter styles
2-
You can edit these or replace them entirely
3-
It's showing you a common way to organise CSS
4-
And includes solutions to common problems
5-
As well as useful links to learn more */
6-
7-
/* ====== Design Palette ======
8-
This is our "design palette".
9-
It sets out the colours, fonts, styles etc to be used in this design
10-
At work, a designer will give these to you based on the corporate brand, but while you are learning
11-
You can design it yourself if you like
12-
Inspect the starter design with Devtools
13-
Click on the colour swatches to see what is happening
14-
I've put some useful CSS you won't have learned yet
15-
For you to explore and play with if you are interested
16-
https://web.dev/articles/min-max-clamp
17-
https://scrimba.com/learn-css-variables-c026
18-
====== Design Palette ====== */
1+
/* ====== Design Palette ====== */
192
:root {
203
--paper: oklch(7 0 0);
214
--ink: color-mix(in oklab, var(--color) 5%, black);
@@ -24,66 +7,76 @@ As well as useful links to learn more */
247
--line: 1px solid;
258
--container: 1280px;
269
}
27-
/* ====== Base Elements ======
28-
General rules for basic HTML elements in any context */
10+
11+
/* ====== Base Elements ====== */
2912
body {
3013
background: var(--paper);
3114
color: var(--ink);
3215
font: var(--font);
16+
margin: 0;
17+
}
18+
19+
/* ✅ CENTER HEADER CONTENT */
20+
header {
21+
text-align: center;
22+
margin-bottom: calc(var(--space) * 2);
3323
}
24+
3425
a {
3526
padding: var(--space);
3627
border: var(--line);
3728
max-width: fit-content;
3829
}
30+
3931
img,
4032
svg {
4133
width: 100%;
4234
object-fit: cover;
4335
}
44-
/* ====== Site Layout ======
45-
Setting the overall rules for page regions
46-
https://www.w3.org/WAI/tutorials/page-structure/regions/
47-
*/
36+
37+
/* ====== Site Layout ====== */
4838
main {
4939
max-width: var(--container);
50-
margin: 0 auto calc(var(--space) * 4) auto;
40+
margin: 0 auto calc(var(--space) * 6) auto;
5141
}
42+
43+
/* ✅ FIXED + CENTERED FOOTER */
5244
footer {
5345
position: fixed;
5446
bottom: 0;
47+
width: 100%;
5548
text-align: center;
49+
background: var(--paper);
50+
padding: var(--space);
51+
border-top: var(--line);
5652
}
57-
/* ====== Articles Grid Layout ====
58-
Setting the rules for how articles are placed in the main element.
59-
Inspect this in Devtools and click the "grid" button in the Elements view
60-
Play with the options that come up.
61-
https://developer.chrome.com/docs/devtools/css/grid
62-
https://gridbyexample.com/learn/
63-
*/
53+
54+
/* ====== Articles Grid Layout ====== */
6455
main {
6556
display: grid;
6657
grid-template-columns: 1fr 1fr;
6758
gap: var(--space);
68-
> *:first-child {
69-
grid-column: span 2;
70-
}
7159
}
72-
/* ====== Article Layout ======
73-
Setting the rules for how elements are placed in the article.
74-
Now laying out just the INSIDE of the repeated card/article design.
75-
Keeping things orderly and separate is the key to good, simple CSS.
76-
*/
60+
61+
main > *:first-child {
62+
grid-column: span 2;
63+
}
64+
65+
/* ====== Article Layout ====== */
7766
article {
7867
border: var(--line);
7968
padding-bottom: var(--space);
8069
text-align: left;
8170
display: grid;
8271
grid-template-columns: var(--space) 1fr var(--space);
83-
> * {
84-
grid-column: 2/3;
85-
}
86-
> img {
87-
grid-column: span 3;
88-
}
8972
}
73+
74+
article > * {
75+
grid-column: 2 / 3;
76+
}
77+
78+
article > img {
79+
grid-column: span 3;
80+
}
81+
82+

0 commit comments

Comments
 (0)