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 ====== */
19-
1+ /* ====== Design Palette ====== */
202: root {
21- --paper : oklch (7 0 0 );
3+ --paper : oklch (97 % 0 0 );
224 --ink : color-mix (in oklab, var (--color ) 5% , black);
235 --font : 100% / 1.5 system-ui;
246 --space : clamp (6px , 6px + 2vw , 15px );
257 --line : 1px solid;
268 --container : 1280px ;
279}
28- /* ====== Base Elements ======
29- General rules for basic HTML elements in any context */
10+
11+ /* ====== Base Elements ====== */
3012body {
3113 background : var (--paper );
3214 color : var (--ink );
3315 font : var (--font );
3416 padding-bottom : 60px ;
17+ margin : 0 ;
3518}
19+
3620a {
37- padding : var (--space );
38- border : var (--line );
39- max-width : fit-content;
40- border-style : none;
21+ display : inline-block;
22+ padding : 0.5rem 1rem ;
23+ background : # 333 ;
24+ color : # fff ;
25+ text-decoration : none;
26+ border-radius : 4px ;
27+ text-align : center;
28+ margin-top : var (--space );
29+ }
30+
31+ a : hover {
32+ background : # 555 ;
4133}
34+
4235img ,
4336svg {
4437 width : 100% ;
38+ height : 250px ; /* Fixed height for all images */
4539 object-fit : cover;
40+ display : block;
4641}
47- /* ====== Site Layout ======
48- Setting the overall rules for page regions
49- https://www.w3.org/WAI/tutorials/page-structure/regions/
50- */
51- main {
52- max-width : var (--container );
53- margin : 0 auto calc (var (--space ) * 4 ) auto;
54- display : flex;
55- }
56- footer {
57- position : fixed;
58- bottom : 0 ;
42+
43+ /* ====== Header ====== */
44+ .header {
5945 text-align : center;
60- height : 60 px ;
61- background-color : # f6f4f4 ;
62- width : 100 % ;
46+ padding : calc ( var ( --space ) * 2 ) ;
47+ background-color : # f6f4f4 ;
48+ margin-bottom : calc ( var ( --space ) * 2 ) ;
6349}
64- /* ====== Articles Grid Layout ====
65- Setting the rules for how articles are placed in the main element.
66- Inspect this in Devtools and click the "grid" button in the Elements view
67- Play with the options that come up.
68- https://developer.chrome.com/docs/devtools/css/grid
69- https://gridbyexample.com/learn/
70- */
50+
51+ .header h1 {
52+ margin : 0 0 var (--space ) 0 ;
53+ }
54+
55+ /* ====== Site Layout ====== */
7156main {
57+ max-width : var (--container );
58+ margin : 0 auto calc (var (--space ) * 4 ) auto;
7259 display : grid;
7360 grid-template-columns : 1fr 1fr ;
7461 gap : var (--space );
75- > * : first-child {
76- grid-column : span 2 ;
77- }
62+ padding : 0 var (--space );
63+ }
64+
65+ main > * : first-child {
66+ grid-column : span 2 ;
7867}
79- /* ====== Article Layout ======
80- Setting the rules for how elements are placed in the article.
81- Now laying out just the INSIDE of the repeated card/article design.
82- Keeping things orderly and separate is the key to good, simple CSS.
83- */
68+
69+ /* ====== Article Layout ====== */
8470article {
8571 border : var (--line );
8672 padding-bottom : var (--space );
8773 text-align : left;
8874 display : grid;
8975 grid-template-columns : var (--space ) 1fr var (--space );
90- > * {
91- grid-column : 2 / 3 ;
92- }
93- > img {
94- grid-column : span 3 ;
95- }
9676}
9777
98- header {
78+ article > * {
79+ grid-column : 2 / 3 ;
80+ }
81+
82+ article > img {
83+ grid-column : span 3 ;
84+ margin-bottom : var (--space );
85+ }
86+
87+ article h2 {
88+ margin-top : var (--space );
89+ }
90+
91+ /* ====== Footer ====== */
92+ .footer {
93+ position : fixed;
94+ bottom : 0 ;
9995 text-align : center;
96+ height : 60px ;
97+ background-color : # f6f4f4 ;
98+ width : 100% ;
99+ display : flex;
100+ align-items : center;
101+ justify-content : center;
102+ border-top : var (--line );
100103}
104+
105+ .footer p {
106+ margin : 0 ;
107+ }
0 commit comments