|
| 1 | +# CSS Layout Exercise: Flexbox & Position |
| 2 | + |
| 3 | +You have been given: |
| 4 | + |
| 5 | +- An **HTML file without CSS** |
| 6 | +- A **screenshot of the final design** located in `/assets/expected-result.png` |
| 7 | + |
| 8 | +Your task is to recreate the layout and visual style shown in the screenshot **using only CSS**. You are not supposed to edit the HTML file. |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | +--- |
| 13 | + |
| 14 | +## 🎯 Objective |
| 15 | + |
| 16 | +The goal of this exercise is to practice: |
| 17 | + |
| 18 | +- **CSS selectors and combinators** |
| 19 | +- **Flexbox layout** |
| 20 | +- **CSS `position` property** |
| 21 | +- **Any other CSS properties you know** |
| 22 | +- Clean and readable CSS (Tip: Try to sort the selectors in the CSS file by ordering them, whenever possible and makes sense, from most generic to most specific) |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +## 📐 Layout Requirements |
| 27 | + |
| 28 | +Using the screenshot as reference, your CSS should include: |
| 29 | + |
| 30 | +### 1. Navigation Bar |
| 31 | + |
| 32 | +- Positioned at the top of the page |
| 33 | +- Horizontal layout |
| 34 | +- Logo on the left, menu items on the right |
| 35 | +- Should remain visible when scrolling (hint: use the `position` property) |
| 36 | + |
| 37 | +### 2. Hero Section |
| 38 | + |
| 39 | +- Centered content (title, text, button) |
| 40 | +- Vertical and horizontal alignment using **Flexbox** |
| 41 | +- A background with a **gradient color** |
| 42 | + |
| 43 | +### 3. Items Section |
| 44 | + |
| 45 | +- A group of cards/items |
| 46 | +- Layout created with **Flexbox** |
| 47 | +- Items should **wrap** on smaller screens |
| 48 | +- There should be some space between items |
| 49 | +- When you **hover over** one of the elements, it should appear a few pixels larger and its background color should change |
| 50 | +- Pay attention to the **"Special Item"** message on one of the cards |
| 51 | + |
| 52 | +### 4. Footer |
| 53 | + |
| 54 | +- Located at the bottom of the page |
| 55 | +- Centered content |
| 56 | +- Footer links aligned horizontally |
| 57 | + |
| 58 | +### 5. "Back to top" Button |
| 59 | + |
| 60 | +- Located at the bottom right of the page |
| 61 | +- Should remain visible and in the same position when scrolling |
| 62 | + |
| 63 | +--- |
| 64 | + |
| 65 | +## 📌 CSS Position Requirements |
| 66 | + |
| 67 | +Your solution must include examples of: |
| 68 | + |
| 69 | +- `position: relative` |
| 70 | +- `position: absolute` |
| 71 | +- `position: fixed` |
| 72 | +- `position: sticky` |
| 73 | +- `display: flex` |
| 74 | + |
| 75 | +Each value should be used **intentionally** and make sense in the layout. |
| 76 | + |
| 77 | +--- |
| 78 | + |
| 79 | +## 📱 Responsive Behavior |
| 80 | + |
| 81 | +- The layout should adapt as much as possible to smaller screens (hints: use `relative widths` and `flex containers` when it is necessary) |
| 82 | +- Items section should wrap correctly |
| 83 | + |
| 84 | +--- |
| 85 | + |
| 86 | +## 🧠 Tips |
| 87 | + |
| 88 | +- Do not focus on matching colors exactly — focus on **layout and behavior** |
| 89 | +- Use comments in your CSS to explain your decisions |
| 90 | +- Think about **why** each `position` or Flexbox property is used |
| 91 | + |
| 92 | +--- |
| 93 | + |
| 94 | +Good luck — and have fun experimenting with CSS! 🚀 |
0 commit comments