Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions 3-terrarium/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,72 @@ You can deploy, or publish your terrarium on the web using Azure Static Web Apps
3. Walk through the wizard creating your app. Make sure you set the app root to either be `/solution` or the root of your codebase. There's no API in this app, so don't worry about adding that. A github folder will be created in your forked repository that will help Azure Static Web Apps' build services, build and publish your app to a new URL.


---

## 💡 Real-World Flexbox Example: Navigation Bar

Flexbox is commonly used in creating responsive navigation bars. Here's a real-world example:

### HTML

Copy link
Preview

Copilot AI Aug 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CSS code block is missing proper markdown formatting. Line 52 should include opening triple backticks with 'css' language identifier, and the CSS section needs a closing triple backticks after line 66.

Copilot uses AI. Check for mistakes.

```html
<nav class="navbar">
<div class="logo">MySite</div>
<ul class="nav-links">
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>

### CSS
.navbar {
display: flex;
justify-content: space-between; /* Push logo to left, links to right */
align-items: center;
padding: 10px 20px;
background-color: #1e1e1e;
color: white;
}

.nav-links {
display: flex;
gap: 15px;
list-style: none;
}

---

## 🧭 Understanding Flexbox with a Real-World Analogy

Think of **Flexbox** as packing a **suitcase** with flexible compartments.

- Each item (child element) adjusts its size and position based on available space.
- If there's extra room, items expand to fill it.
- If space is tight, they shrink or wrap to stay inside the container.

Just like how you might align socks, shirts, and shoes neatly in rows, Flexbox helps align items in a row or column—**with flexibility**.

---

## 🔍 Quick Visual Guide to Flexbox Properties

| Property | Description | Example Value |
|----------------|----------------------------------------------|-------------------|
| `display` | Enables Flexbox on a container | `flex` |
| `flex-direction`| Sets direction of items | `row`, `column` |
| `justify-content`| Horizontal alignment | `center`, `space-between` |
| `align-items` | Vertical alignment | `flex-start`, `center` |
| `flex-wrap` | Whether items wrap onto multiple lines | `wrap`, `nowrap` |

---

## 🎯 Pro Tip: Use DevTools

Right-click any flex container > Inspect > Look for the **Flexbox badge** in Chrome DevTools. You can see how space is distributed live!

---