Menu
CoddyTech

Wrapping Navigation

Part of the Responsive UI Patterns section of Coddy's Tailwind CSS journey. Lesson 6 of 55.

Navigation must tolerate labels that take more room than expected. Keep links as anchors inside a labeled nav landmark, then apply layout to their list. This example keeps 8px between rows and 20px between columns.

<nav aria-label="Library"><ul class="flex flex-wrap gap-x-5 gap-y-2"><li><a href="#books">Books</a></li><li><a href="#events">Events</a></li></ul></nav>

The gap-x-* and gap-y-* families control independent axes: gap-x-5 is 20px and gap-y-2 is 8px. flex-wrap permits a new line instead of forcing all links into one row.

Responsive direction can make a compact menu easier to scan. Use a vertical base direction and sm:flex-row for horizontal navigation from 640px upward. Preserve DOM order so the visual and reading sequences agree.

challenge icon

Challenge

Medium

Arrange the three workshop links in a wrapping horizontal flex list. Keep 16px between neighboring items and 12px between rows. Preserve the labeled navigation landmark and all three links.

Preserve the supplied content, semantic elements and IDs. Edit the requested utility classes. Press Run preview after edits, then Check/Run code to grade the result. Supplied JavaScript is read-only.

Try it yourself

<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Interface workshop</title><link rel="stylesheet" href="./styles.css"></head><body>
<nav aria-label="Workshop" class="w-72"><ul id="links" class="flex flex-nowrap"><li class="w-28"><a href="#overview">Overview</a></li><li class="w-28"><a href="#sessions">Sessions</a></li><li class="w-28"><a href="#travel">Travel</a></li></ul></nav>
</body></html>
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Responsive UI Patterns