CSS Mobile Tab Bar

An app-style bottom navigation bar with icons, labels and an active pill.

  • mobile
  • tab bar
  • bottom navigation
  • icons
  • app
HTML
<nav class="tab-bar">
  <a href="#" aria-current="page"><svg viewBox="0 0 24 24"><path d="M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z"/></svg>Home</a>
  <a href="#"><svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg>Search</a>
  <a href="#"><svg viewBox="0 0 24 24"><path d="M19.5 12.6 12 20l-7.5-7.4A4.9 4.9 0 0 1 12 6a4.9 4.9 0 0 1 7.5 6.6z"/></svg>Saved</a>
  <a href="#"><svg viewBox="0 0 24 24"><circle cx="12" cy="8" r="4"/><path d="M4 21a8 8 0 0 1 16 0"/></svg>Profile</a>
</nav>
CSS
.tab-bar {
  display: flex;
  width: 280px;
  padding: 8px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.2);
  font: 600 11px system-ui, sans-serif;
}

.tab-bar a {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
  border-radius: 14px;
  color: #94a3b8;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.tab-bar svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab-bar a:hover {
  color: #4f46e5;
}

.tab-bar a[aria-current="page"] {
  background: #eef2ff;
  color: #4f46e5;
}

About this CSS Mobile Tab Bar

This CSS Mobile Tab Bar is 41 lines of pure CSS (0.7 KB) with no JavaScript and no dependencies. It uses transitions, box shadows and Flexbox. It works in current versions of Chrome, Edge, Safari and Firefox. It works in any stack: plain HTML, React, Vue, Svelte, Astro, WordPress or Webflow.

CSS features used

Customize it

The colors in this snippet. Search and replace them to match your brand:

  • #fff
  • #94a3b8
  • #4f46e5
  • #eef2ff

How to use this mobile tab bar

  1. Copy the HTML and paste it where you want the element to appear.
  2. Copy the CSS into your stylesheet, or inside a <style> tag.
  3. Keep the .tab-bar class name, or rename it in both places. Then tweak colors, sizes and timing to match your design.
  4. Using React or Next.js? Change class to className in the HTML. The CSS works as is, including in Tailwind projects (put it in your global stylesheet).

Building with an AI tool?

“Copy for AI” copies a short prompt for Cursor, Claude Code, Lovable, Bolt or v0. Your AI tool opens the Markdown version of this snippet and reads the HTML, CSS and setup notes there. If your tool can't open links, with the code instead. More ways to use copy CSS with AI.

Feedback