1- /*
2- (Suggestion) Use a top-down approach when applying CSS:
3- 1. Lay out the top-level elements: <header>, <main>, <footer>
4- 2. Lay out the articles within <main>
5- 3. Style individual elements
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 */
66
7- Please REMOVE this comment before submitting your work.
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+ : 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 ;
26+ }
27+ /* ====== Base Elements ======
28+ General rules for basic HTML elements in any context */
29+ body {
30+ background : var (--paper );
31+ color : var (--ink );
32+ font : var (--font );
33+ }
34+ a {
35+ padding : var (--space );
36+ border : var (--line );
37+ max-width : fit-content;
38+ }
39+ img ,
40+ svg {
41+ width : 100% ;
42+ object-fit : cover;
43+ }
44+ /* ====== Site Layout ======
45+ Setting the overall rules for page regions
46+ https://www.w3.org/WAI/tutorials/page-structure/regions/
847*/
48+ main {
49+ max-width : var (--container );
50+ margin : 0 auto calc (var (--space ) * 4 ) auto;
51+ }
52+ footer {
53+ position : fixed;
54+ bottom : 0 ;
55+ text-align : center;
56+ border-top : var (--line );
57+ width : 100% ;
58+ background : var (--paper );
59+ padding : var (--space );
60+ }
61+ /* ====== Articles Grid Layout ====
62+ Setting the rules for how articles are placed in the main element.
63+ Inspect this in Devtools and click the "grid" button in the Elements view
64+ Play with the options that come up.
65+ https://developer.chrome.com/docs/devtools/css/grid
66+ https://gridbyexample.com/learn/
67+ */
68+ main {
69+ display : grid;
70+ grid-template-columns : 1fr 1fr ;
71+ gap : var (--space );
72+ > * : first-child {
73+ grid-column : span 2 ;
74+ }
75+ }
76+
77+ h1 {
78+ text-align : center;
79+ }
80+ header p {
81+ text-align : center;
82+ }
83+
84+ /* ====== Article Layout ======
85+ Setting the rules for how elements are placed in the article.
86+ Now laying out just the INSIDE of the repeated card/article design.
87+ Keeping things orderly and separate is the key to good, simple CSS.
88+ */
89+ article {
90+ border : var (--line );
91+ padding-bottom : var (--space );
92+ text-align : left;
93+ display : grid;
94+ grid-template-columns : var (--space ) 1fr var (--space );
95+ > * {
96+ grid-column : 2 / 3 ;
97+ }
98+ > img {
99+ grid-column : span 3 ;
100+ }
101+ }
0 commit comments