CSS Vertical Side Nav
A dashboard side menu with an accent bar on the active item.
HTML
<nav class="side-nav" aria-label="Main">
<a href="#" aria-current="page">Dashboard</a>
<a href="#">Projects</a>
<a href="#">Team</a>
<a href="#">Settings</a>
</nav>
CSS
.side-nav {
display: grid;
gap: 2px;
width: 180px;
padding: 8px;
border-radius: 14px;
background: #fff;
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
font: 500 14px/1 system-ui, sans-serif;
}
.side-nav a {
position: relative;
padding: 10px 14px;
border-radius: 8px;
color: #475569;
text-decoration: none;
transition: background 0.15s ease, color 0.15s ease;
}
.side-nav a:hover {
background: #f1f5f9;
color: #0f172a;
}
.side-nav a[aria-current="page"] {
background: #eef2ff;
color: #4338ca;
font-weight: 600;
}
.side-nav a[aria-current="page"]::before {
content: "";
position: absolute;
top: 8px;
bottom: 8px;
left: 0;
width: 3px;
border-radius: 0 3px 3px 0;
background: #4f46e5;
}
About this CSS Vertical Side Nav
This CSS Vertical Side Nav is 41 lines of pure CSS (0.7 KB) with no JavaScript and no dependencies. It uses transitions, box shadows and CSS Grid. 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#475569#f1f5f9#0f172a#eef2ff#4338ca#4f46e5
How to use this vertical side nav
- 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
.side-navclass 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.