Sub topic 1
Why desktop navigation fails on phones
This chapter explains what changes when a navigation bar moves from a desktop monitor to a phone. It sets up the three patterns the rest of the tutorial builds: the hamburger menu, the bottom tab bar, and the priority menu.
Prerequisites
This chapter assumes you already know:
- Basic HTML structure and semantic elements such as
header,nav, andul. - CSS layout with flexbox and media queries.
- Basic JavaScript: selecting elements and handling events.
The desktop bar as a starting point
A typical desktop navigation is a horizontal row of links across the top of the page. It works because the screen is wide, the pointer is precise, and the user's hand rests on a mouse or trackpad.
<nav aria-label="Main">
<ul class="nav-row">
<li><a href="/products">Products</a></li>
<li><a href="/pricing">Pricing</a></li>
<li><a href="/docs">Docs</a></li>
<li><a href="/blog">Blog</a></li>
<li><a href="/about">About</a></li>
<li><a href="/contact">Contact</a></li>
</ul>
</nav>
<style>
.nav-row {
display: flex;
gap: 1rem;
list-style: none;
margin: 0;
padding: 0;
}
</style>Six links at about 100px each need roughly 600px plus gaps. A phone in portrait mode is commonly 360 to 430 CSS pixels wide, so the row overflows or wraps. Add a logo, a search link, or a longer label such as "Customer support", and the problem grows.
Three constraints that change the design
Screen size, input method, and hand position each break a desktop assumption.
| Constraint | Desktop assumption | Phone reality |
|---|---|---|
| Screen size | Hundreds of pixels spare for links | Roughly 360 to 430 CSS pixels in portrait |
| Input | A pointer that hits a 20px link reliably | A fingertip that covers about 40 to 60 pixels |
| Hand position | Hands at a keyboard or mouse | One thumb, often on a moving train or while walking |
Screen size
Navigation competes with content for a small area. A header that wraps to three rows can take a third of the first screen before any content appears. Patterns for mobile either hide links until requested (hamburger), move them to a different place (tab bar), or show only as many as fit (priority menu).
Touch input
A mouse pointer is a single pixel. A finger is a wide, imprecise contact area, and it hides what is under it. Links that are fine to click with a mouse become hard to hit when they are small or close together. Mis-taps send users to the wrong page, which feels like a broken site. A later chapter covers target sizes in detail. For now, remember that a common guideline is at least 44 to 48 pixels in each direction.
Hover does not exist
Many desktop menus open a dropdown on :hover. Touch screens have no steady hover state. Depending on the browser, the first tap may simulate hover and the second tap follow the link, or the dropdown may never open. Any navigation that works only on hover is unusable for touch users, and also for keyboard users.
Thumb reach
Most people hold a phone in one hand and use the thumb. The easiest area to reach is the lower middle of the screen. The top corners are hardest, especially on large phones. A top-right menu button is easy to reach on a small phone and awkward on a big one. This is why the bottom tab bar became common on large phones.
What the failure looks like
You can see the problem without a phone. Open the desktop example above in your browser's responsive design mode and set the width to 375px. Typical results:
- The list overflows horizontally and creates a sideways scrollbar.
- Or the flex items shrink and the labels wrap onto several lines, making each link tall and hard to read.
- Link spacing stays at 1rem, but the hit areas are only as tall as the text.
Without a viewport meta tag, the problem is hidden in a different way. The phone pretends to be about 980px wide and shrinks the whole page, so the nav fits but the text is tiny and the user must pinch-zoom. The next chapter covers that tag.
The three patterns at a glance
Each pattern answers the constraints differently.
| Pattern | Idea | Main trade-off |
|---|---|---|
| Hamburger menu | Hide all links behind a toggle button | Saves space, but links are out of sight |
| Bottom tab bar | Fix a few top destinations at the bottom of the screen | Easy to reach, but limited to a handful of items |
| Priority menu | Show as many links as fit, move the rest to "More" | Keeps key links visible, but needs JavaScript |
Common errors to avoid
- Shrinking the font to fit all links. Text under about 16px and targets under 44px hurt both readability and accuracy.
- Relying on hover for dropdowns.
- Replacing
aelements with clickabledivelements, which loses keyboard and screen reader support. - Testing only in a narrow desktop window.
Exercise
A site has seven top-level links in a horizontal row that works at 1200px wide. On a 375px phone the row overflows. Name two reasons that simply shrinking the links to fit is a poor fix.
Show answer
First, shrinking the text and spacing makes the touch targets smaller than the roughly 44 to 48 pixels a fingertip needs, so users mis-tap. Second, small text is hard to read on a phone. A hover-only dropdown would also fail, since touch screens have no steady hover state. A better fix is a pattern such as a hamburger menu, tab bar, or priority menu.