Lesson 3 of 4 · 14 min read
CSS: colour, spacing and layout
CSS selects HTML elements and applies styles to them:
h1 { color: #0f1b33; font-size: 42px; }
.card { padding: 24px; border-radius: 16px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
Two layout tools cover 95% of real websites:
- Flexbox — arranges items in a row or column (navbars, buttons).
- Grid — arranges items in rows and columns (card layouts, galleries).
Use @media (max-width: 700px) { … } to change the layout on phones — over 75% of Indian web traffic is mobile.
⚡ Quick check
Which CSS tool is best for a 3-column card layout?
Grid handles rows and columns together, perfect for card layouts.