Chapter 7: Vertical Tabs

How to create vertical tabs (also called side tabs, left sidebar tabs, vertical tab navigation, etc.).

Vertical tabs are very common in:

  • Admin dashboards
  • Settings pages
  • Long forms / wizards
  • Documentation sites
  • Email clients / project management tools
  • Desktop-style web applications

Let’s build them properly — from simple to professional — with clear explanations and real-world considerations.

What makes good vertical tabs?

  • The active tab is clearly visible (color, border, background, icon…)
  • Tabs stay fixed or scroll with content (depending on design)
  • Content area takes most of the space on the right
  • Looks good on desktop → collapses gracefully on mobile (usually becomes horizontal tabs or accordion)
  • Keyboard accessible
  • Works with mouse, touch, and screen readers

We’ll create three versions:

  1. Simple & clean vertical tabs (pure HTML + CSS + minimal JS)
  2. Responsive version (desktop vertical → mobile horizontal)
  3. Modern, accessible version with ARIA + smooth transitions

Version 1 – Clean & Classic Vertical Tabs

HTML Structure

HTML

CSS (modern & clean look)

CSS

JavaScript (minimal & clean)

JavaScript

Version 2 – Responsive (Desktop vertical → Mobile horizontal)

Add a media query to switch layout on small screens.

CSS

Now on mobile the tabs become a horizontal scrollable bar — very common pattern.

Version 3 – With Icons + Better Visual Feedback

Add icons (using Font Awesome or similar):

HTML

CSS adjustment:

CSS

Important Things Good Developers Always Consider

  1. Active indicator Most common options: left border, background color, text color + bold, subtle shadow
  2. Minimum touch/click target Buttons should be at least 44×44 px (mobile) — we usually make them taller (52–60 px)
  3. Keyboard navigation
    • Tab key should move between tab buttons
    • Arrow keys can move focus between tabs (optional but nice)
  4. Mobile behavior
    • Horizontal scrollable tabs
    • OR collapse to accordion (using <details>)
  5. Lazy loading (advanced) Only load content of the active tab — useful for heavy dashboards
  6. Sticky tabs (sometimes) If the tab list is long, you can make it position: sticky; top: 0;

Quick Checklist Before You Finish

  • Clear visual difference for active tab
  • Enough padding & spacing
  • Works on mobile (test at 320–768 px)
  • Keyboard focus is visible
  • aria-selected and aria-controls are correct
  • role=”tablist”, role=”tab”, role=”tabpanel” used

Would you like to go deeper into any of these next topics?

Examples:

  • How to make vertical tabs sticky when scrolling
  • How to turn vertical tabs into accordion on mobile
  • How to add smooth slide/fade animation
  • How to make icon-only tabs with tooltips
  • How to handle very long tab lists (scrollable sidebar)
  • How to do vertical tabs in Tailwind CSS
  • How to make nested / sub-tabs inside a tab

Just tell me what you want next — I’ll explain it slowly with complete code examples. 😊

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *