The sidebar has been declared dead more times than we can count, yet it keeps showing up in the interfaces we use every day. Documentation sites, admin dashboards, email clients, blogs, and SaaS apps all rely on the humble sidebar to organize navigation and secondary content. So why does it work, and when should you actually reach for a sidebar layout in your web design?
In this practical guide, we cover when a sidebar layout still makes sense in 2026, the UX principles behind good sidebar design, and copy-paste CSS Grid and Flexbox code to build sticky, responsive sidebars that behave well on any screen.
What Is a Sidebar Layout in Web Design?
A sidebar layout is a two-column structure where a narrower column sits next to a wider main content area. The narrow column, the sidebar, typically holds navigation, filters, metadata, or contextual actions. The wide column holds the primary content the user came for.
Sidebars can be:
- Fixed: Always visible on the left or right of the viewport.
- Sticky: Scrolls with the page up to a point, then locks in place.
- Collapsible: Can be toggled open or closed by the user.
- Off-canvas: Hidden by default, slides in when triggered (common on mobile).

When to Use a Sidebar Layout (and When Not To)
Not every website needs a sidebar. Marketing landing pages, storytelling sites, and portfolio hero sections usually do better with full-width layouts. But there are use cases where sidebars remain the best tool for the job.
Good Fit: Documentation Sites
Docs need persistent, hierarchical navigation. Users jump between sections constantly, so hiding the menu behind a hamburger icon slows everyone down. Sites like MDN, Stripe Docs, and Tailwind CSS docs all use sidebars for good reason.
Good Fit: Admin Dashboards and SaaS Apps
Dashboards juggle many features across sections like analytics, billing, users, and settings. A sidebar keeps top-level navigation one click away without eating horizontal space above the fold.
Good Fit: Blogs with Filters or Widgets
A blog sidebar can house categories, recent posts, an author bio, or a newsletter signup. It works especially well when readers are browsing rather than arriving from search for a single article.
Good Fit: E-commerce Category Pages
Faceted filters (price, size, color, brand) are the classic sidebar use case. Users need to see filters and results simultaneously.
Poor Fit
- Landing pages focused on a single conversion goal.
- Long-form editorial content where reading focus matters.
- Mobile-first apps where screen real estate is at a premium (use off-canvas instead).
Sidebar Layout Types Compared
| Type | Best For | Complexity |
|---|---|---|
| Fixed sidebar | Dashboards, apps | Low |
| Sticky sidebar | Blogs, docs | Low |
| Collapsible sidebar | Power-user tools | Medium |
| Off-canvas sidebar | Mobile navigation | Medium |
Building a Sidebar Layout with CSS Grid
CSS Grid is the cleanest modern approach for a two-column sidebar layout. Here is a minimal, responsive example.
HTML Structure
<div class="layout">
<aside class="sidebar">
<nav>
<a href="#">Dashboard</a>
<a href="#">Projects</a>
<a href="#">Team</a>
<a href="#">Settings</a>
</nav>
</aside>
<main class="content">
<h1>Main content goes here</h1>
</main>
</div>
CSS with Grid
.layout {
display: grid;
grid-template-columns: 260px 1fr;
min-height: 100vh;
}
.sidebar {
background: #1e293b;
color: #fff;
padding: 1.5rem;
}
.sidebar nav {
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.content {
padding: 2rem;
}
@media (max-width: 768px) {
.layout {
grid-template-columns: 1fr;
}
}
This gives you a rock-solid two-column layout that stacks on mobile. The 1fr unit tells the main column to consume all remaining space, no matter the viewport width.

Building a Sticky Sidebar with Flexbox
Flexbox works great when you want the sidebar to stick as the user scrolls, which is perfect for docs and long blog posts.
.layout {
display: flex;
gap: 2rem;
max-width: 1200px;
margin: 0 auto;
padding: 2rem;
}
.sidebar {
flex: 0 0 240px;
position: sticky;
top: 1rem;
align-self: flex-start;
max-height: calc(100vh - 2rem);
overflow-y: auto;
}
.content {
flex: 1;
min-width: 0;
}
@media (max-width: 768px) {
.layout { flex-direction: column; }
.sidebar { position: static; flex: 1; }
}
Two things make this work:
position: stickycombined with atopvalue locks the sidebar as you scroll past it.align-self: flex-startstops the flex item from stretching to the full height, which would break sticky positioning.
Making the Sidebar Collapsible
For dashboards and apps, users often want to collapse the sidebar to reclaim screen space. Here is a lightweight approach using a CSS custom property.
.layout {
--sidebar-width: 260px;
display: grid;
grid-template-columns: var(--sidebar-width) 1fr;
transition: grid-template-columns 0.25s ease;
}
.layout.collapsed {
--sidebar-width: 64px;
}
.sidebar {
overflow: hidden;
white-space: nowrap;
}
Add a JavaScript toggle that flips the .collapsed class on the layout container, and the transition handles the rest. Swap link labels for icons when collapsed for the classic dashboard look.
UX Best Practices for Sidebar Design
- Keep depth shallow. Two levels of nesting is the practical maximum. Beyond that, users get lost.
- Highlight the active item clearly with color, weight, or a left border accent.
- Group related links and use short section labels rather than icons alone.
- Test at 1024px, 768px, and 375px. Sidebars that work on desktop can wreck mobile UX if not planned.
- Respect the fold. The most-used links should sit above 600px of scroll.
- Do not overload it. A sidebar with 20 items is a sign you need a different information architecture.

Accessibility Checklist
- Wrap navigation in a
<nav>element with anaria-label. - Ensure focus states are visible on every link.
- If the sidebar is collapsible, use
aria-expandedon the toggle button. - Off-canvas sidebars must trap focus when open and close on Escape.
- Test tab order. The sidebar should come before or after main content in a logical way.
Common Mistakes to Avoid
- Placing critical actions in a sidebar that gets hidden on mobile without a fallback.
- Using a sidebar to house ads or unrelated widgets that dilute focus.
- Making the sidebar wider than 320px, which starves the main content.
- Forgetting that sticky sidebars break inside overflow containers.
- Using icon-only navigation without tooltips or labels.
FAQ
Are sidebars still relevant in 2026?
Yes, for the right use cases. Documentation, dashboards, admin tools, and blog archives still benefit from persistent navigation. What has changed is that sidebars are now expected to be responsive, sticky when useful, and collapsible when space is tight.
Should the sidebar go on the left or right?
Left sidebars are the convention for navigation because Western users read left to right and expect controls there. Right sidebars work better for contextual or secondary content like related articles, table of contents, or filters that supplement the main view.
What is the ideal width for a sidebar?
For navigation sidebars, 220px to 280px is the sweet spot. Collapsed states typically run 56px to 72px to fit icons. Filter sidebars can go up to 320px if they contain form controls.
Grid or Flexbox for sidebar layouts?
Use Grid when you want a strict two-column structure with predictable column widths. Use Flexbox when you need a sticky sidebar or when the main content should flex around a fixed-width side column. Both are fully supported in every modern browser.
How do I handle the sidebar on mobile?
The two most common patterns are stacking the sidebar above the content, which works for blogs, or converting it into an off-canvas drawer triggered by a hamburger button, which works better for dashboards and apps.
Wrapping Up
A well-built sidebar layout is one of the most reliable patterns in web design. It solves real navigation problems for docs, dashboards, blogs, and e-commerce. The trick is choosing the right variant for your use case, keeping it lean, and making sure it degrades gracefully on smaller screens.
At Fat Cow Web Design, we build interfaces where structure serves the user, not the other way around. If you need help designing a sidebar layout that actually helps people find what they need, get in touch.
