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 */
61
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 ====== */
192: root {
203 --paper : oklch (7 0 0 );
214 --ink : color-mix (in oklab, var (--color ) 5% , black);
@@ -24,66 +7,91 @@ 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+
2912body {
3013 background : var (--paper );
3114 color : var (--ink );
3215 font : var (--font );
16+ margin : 0 ;
17+ padding : 0 ;
18+ min-height : 100vh ;
19+ display : flex;
20+ flex-direction : column;
3321}
22+
3423a {
3524 padding : var (--space );
3625 border : var (--line );
3726 max-width : fit-content;
27+ text-decoration : none;
28+ color : inherit;
29+ transition : all 0.3s ease;
3830}
39- img ,
40- svg {
41- width : 100% ;
42- object-fit : cover;
31+
32+ a : hover {
33+ background : var (--ink );
34+ color : black;
35+ transform : translateY (-5px );
36+ }
37+
38+
39+ header {
40+ padding : calc (var (--space ) * 2 );
41+ text-align : center;
42+ background : rgb (240 , 199 , 146 );
4343}
44- /* ====== Site Layout ======
45- Setting the overall rules for page regions
46- https://www.w3.org/WAI/tutorials/page-structure/regions/
47- */
44+
4845main {
4946 max-width : var (--container );
50- margin : 0 auto calc (var (--space ) * 4 ) auto;
47+ margin : 0 auto;
48+ padding : calc (var (--space ) * 2 );
49+ flex : 1 ;
5150}
51+
5252footer {
53- position : fixed;
54- bottom : 0 ;
53+ background : rgb (235 , 209 , 175 );
54+ /* border-top: var(--line); */
55+ padding : (var (--space ));
5556 text-align : center;
57+ margin-top : auto;
5658}
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- */
59+
6460main {
6561 display : grid;
6662 grid-template-columns : 1fr 1fr ;
67- gap : var (--space );
68- > * : first-child {
69- grid-column : span 2 ;
70- }
63+ gap : calc (var (--space ) * 2 );
64+ }
65+
66+ main > * : first-child {
67+ grid-column : span 2 ;
7168}
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- */
69+
7770article {
7871 border : var (--line );
79- padding-bottom : var (--space );
72+ padding : calc ( var (--space ) * 2 );
8073 text-align : left;
81- display : grid;
82- grid-template-columns : var (--space ) 1fr var (--space );
83- > * {
84- grid-column : 2 / 3 ;
74+ display : flex;
75+ flex-direction : column;
76+ gap : var (--space );
77+ }
78+
79+ article h2 {
80+ margin : 0 ;
81+ font-size : 1.5em ;
82+ }
83+
84+ article p {
85+ margin : 0 ;
86+ flex : 1 ;
87+ }
88+
89+ @media (max-width : 768px ) {
90+ main {
91+ grid-template-columns : 1fr ;
8592 }
86- > img {
87- grid-column : span 3 ;
93+
94+ main > * : first-child {
95+ grid-column : span 1 ;
8896 }
8997}
0 commit comments