CSS Scrollable Tab Bar
A row of tab links that scrolls sideways on small screens, with snap points and a faded edge hint.
<nav class="scroll-tabs" aria-label="Categories">
<a href="#" aria-current="page">All</a>
<a href="#">Design</a>
<a href="#">Development</a>
<a href="#">Marketing</a>
<a href="#">Product</a>
<a href="#">Research</a>
</nav>
.scroll-tabs {
display: flex;
max-width: 260px;
overflow-x: auto;
padding: 0 32px 0 4px;
border-bottom: 1px solid #e5e7eb;
scroll-snap-type: x proximity;
scrollbar-width: none;
font: 600 14px system-ui, sans-serif;
-webkit-mask: linear-gradient(90deg, #000 calc(100% - 40px), transparent);
mask: linear-gradient(90deg, #000 calc(100% - 40px), transparent);
}
.scroll-tabs::-webkit-scrollbar {
display: none;
}
.scroll-tabs a {
flex: none;
padding: 12px 12px 10px;
border-bottom: 2px solid transparent;
color: #6b7280;
text-decoration: none;
scroll-snap-align: start;
}
.scroll-tabs a:hover {
color: #111827;
}
.scroll-tabs a[aria-current="page"] {
border-bottom-color: #e11d48;
color: #e11d48;
}
.scroll-tabs a:focus-visible {
border-radius: 6px;
outline: 2px solid #e11d48;
outline-offset: -2px;
}
About this CSS Scrollable Tab Bar
This CSS Scrollable Tab Bar is 40 lines of pure CSS (0.8 KB) with no JavaScript and no dependencies. It uses linear gradients, masks, Flexbox and scroll snapping. 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:
#e5e7eb#000#6b7280#111827#e11d48
How to use this scrollable tab bar
- Copy the HTML and paste it where you want the element to appear.
- Copy the CSS into your stylesheet, or inside a
<style>tag. - Keep the
.scroll-tabsclass name, or rename it in both places. Then tweak colors, sizes and timing to match your design. - Using React or Next.js? Change
classtoclassNamein 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.