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- : 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 ;
1+ V /* Reset */
2+ * {
3+ margin : 0 ;
4+ padding : 0 ;
5+ box-sizing : border-box;
266}
27- /* ====== Base Elements ======
28- General rules for basic HTML elements in any context */
7+
8+ /* Base styles */
299body {
30- background : var (--paper );
31- color : var (--ink );
32- font : var (--font );
10+ font-family : Arial, Helvetica, sans-serif;
11+ background-color : # f4f4f4 ;
12+ color : # 333 ;
13+ line-height : 1.6 ;
3314}
34- a {
35- padding : var (--space );
36- border : var (--line );
37- max-width : fit-content;
15+
16+ /* Header */
17+ header {
18+ background : # 222 ;
19+ color : # fff ;
20+ padding : 2rem 1rem ;
21+ text-align : center;
3822}
39- img ,
40- svg {
41- width : 100 % ;
42- object-fit : cover ;
23+
24+ header p {
25+ max- width: 700 px ;
26+ margin : 0 auto ;
4327}
44- /* ====== Site Layout ======
45- Setting the overall rules for page regions
46- https://www.w3.org/WAI/tutorials/page-structure/regions/
47- */
28+
29+ /* Main container */
4830main {
49- max-width : var (--container );
50- margin : 0 auto calc (var (--space ) * 4 ) auto;
31+ max-width : 1100px ;
32+ margin : 2rem auto;
33+ padding : 0 1rem ;
5134}
52- footer {
53- position : fixed;
54- bottom : 0 ;
55- text-align : center;
56- }
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- */
64- main {
35+
36+ /* GRID LAYOUT */
37+ section {
6538 display : grid;
6639 grid-template-columns : 1fr 1fr ;
67- gap : var (--space );
68- > * : first-child {
69- grid-column : span 2 ;
70- }
40+ gap : 1.5rem ;
7141}
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- */
42+
43+ /* First article spans full width */
44+ section article : first-child {
45+ grid-column : 1 / -1 ;
46+ }
47+
48+ /* Article styling */
7749article {
78- border : var (--line );
79- padding-bottom : var (--space );
80- text-align : left;
81- display : grid;
82- grid-template-columns : var (--space ) 1fr var (--space );
83- > * {
84- grid-column : 2 / 3 ;
85- }
86- > img {
87- grid-column : span 3 ;
88- }
50+ background : # fff ;
51+ padding : 1.5rem ;
52+ border : 1px solid # ccc ;
53+ border-radius : 6px ;
54+ }
55+
56+ /* Images */
57+ article img {
58+ width : 100% ;
59+ height : auto;
60+ margin-bottom : 1rem ;
61+ border : 1px solid # ddd ;
62+ }
63+
64+ /* Headings */
65+ article h2 {
66+ margin-bottom : 0.75rem ;
67+ }
68+
69+ /* Links */
70+ article a {
71+ display : inline-block;
72+ margin-top : 1rem ;
73+ color : # 0066cc ;
74+ text-decoration : none;
75+ font-weight : bold;
8976}
77+
78+ article a : hover {
79+ text-decoration : underline;
80+ }
81+
82+ /* Footer */
83+ footer {
84+ background : transparent;
85+ color : black;
86+ text-align : center;
87+ padding : 1rem ;
88+ position : fixed;
89+ bottom : 0 ;
90+ }
91+
92+ /* MOBILE: stack everything */
93+ @media (max-width : 700px ) {
94+ section {
95+ grid-template-columns : 1fr ;
96+ }
97+ }
0 commit comments