Skip to content
Learn Netverks

Lesson

Step 11/31 35% through track

flex-navigation

Flexbox navigation bar

Last reviewed May 28, 2026 Content v20260528
Track mode
iframe_html
Means
HTML preview sandbox
Reading
~1 min
Level
intermediate

This lesson

This lesson teaches Flexbox navigation bar—the ideas, syntax, and habits you need before moving on in HTML & CSS.

Most modern layouts are built with flexbox and grid; skipping this lesson leaves responsive UI fragile.

You will apply Flexbox navigation bar in contexts like: Site chrome, skip links, and landmark regions crawled by search engines and screen readers.

Read the lesson, edit HTML/CSS in the playground, press Run to preview, then answer the lesson MCQs.

When the previous lesson's MCQs feel easy and you can explain Flexbox navigation bar in your own words.

Flexbox shines for one-dimensional rows: logo on the left, links on the right, wrapping on small screens. You will use it constantly in headers.

Core properties

  • display: flex on the container.
  • justify-content: space-between — push groups apart.
  • align-items: center — vertical alignment.
  • gap — space between items without margin hacks.

HTML structure

Keep nav links in a <ul> inside <nav> for semantics; reset list styles in CSS.

Practice

  1. Add a fourth nav item—gap keeps spacing even.
  2. Set flex-wrap: wrap and shrink the window.
  3. Try margin-left: auto on the ul instead of space-between.

Important interview questions and answers

  1. Q: Flexbox vs Grid in one line?
    A: Flex lays out along one axis; Grid handles two-dimensional rows and columns together.
  2. Q: What does `justify-content` control?
    A: Alignment along the main axis of the flex container.
  3. Q: Why use `gap` instead of margins on every item?
    A: Gap is consistent, avoids first/last margin bugs, and works with wrapping.

Challenge

Collapse the nav

  1. At max-width: 30rem, stack brand and links vertically with flex-direction: column.

Done when: narrow preview shows stacked nav without overflow.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs in your browser in a sandboxed frame. Backend runners appear when this track’s profile allows them.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • What part of this lesson needs a second read?
  • What would you try differently in a real project?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump