CSS Only Vertical Accordion Sidebar Menu

In this tutorial we will see how to create a CSS Vertical Accordion Menu. For this we have used pure CSS, this is a vertical accordion menu with toggle effect.


Take a look at the HTML code given below.

<!DOCTYPE html>
<html lang="">
 <meta charset="utf-8">
 <title>CSS Only Vertical Accordion Menu</title>
 <meta name="viewport" content="width=device-width, initial-scale=1.0">
 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css">
 <link href="style.css" rel="stylesheet">
 <nav class="menu">
	<input type="radio" name="menu" id="dashboard" checked>
    <label for="dashboard" class="title">
    <i class="fa fa-dashboard"></i>Dashboard
	<a href="#">Projects</a>
    <a href="#">Tools</a>
    <a href="#">Analytics</a>
  <input type="radio" name="menu" id="tasks">
	<label for="tasks" class="title">
     <i class="fa fa-tasks"></i>Tasks
	<a href="#">HTML</a>
    <a href="#">CSS</a>
    <a href="#">JavaScript</a>
  <input type="radio" name="menu" id="profile">
    <label for="profile" class="title">
    <i class="fa fa-user"></i>Profile
	<a href="#">Messages</a>
	<a href="#">Settings</a>
    <a href="#">Logout</a>
 <div class="main">
  <p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</p>

CSS Code

CSS code is given below.

    margin: 0;
	padding: 0;
    font-family: monospace;
    box-sizing: border-box;
nav { 
	width: 20%;
    height: 100vh;
	background-color: #111;
    float: left;
    background: linear-gradient(#000, #222);
	font-size: 14px;
	display: block;
	padding: 10px 15px;
	cursor: pointer;
    transition: all .25s;
	color: #FFF;
ul li{
	background-color: #111;
	height: 35px;
	overflow: hidden;
	transition: all .3s;
	font-weight: bold;	
	font-size: 12px;
	text-decoration: none;
	display: block;
	padding: 10px 25px;
	transition: all .25s;
	color: #FFF;
a:hover {
	background-color: #333;
    box-shadow: inset 5px 0px 0px 0px #f00;
.title:hover {
	text-shadow: 0px 0px 10px #fff;
input[type="radio"] {
	display: none;
#dashboard:checked + li, #tasks:checked + li, #profile:checked + li {
	height: 140px;
i {
	margin-right: 10px;
.main {
    width: 80%;
    padding: 10px;
    float: right;

Video Tutorial

Watch our video tutorial on CSS Only Vertical Accordion Menu.

Social Media Menu with Popup Tooltip using HTML and CSS Horizontal Navigation Menu with HTML and CSS Responsive Sidebar Menu with CSS and JavaScript Cool CSS Button with Hover Animation Pure CSS Custom Radio Buttons Custom Emoji Radio Buttons with CSS Color Picker Design with HTML CSS and JavaScript Custom Radio Buttons with CSS Engraved HTML Buttons With CSS Neumorphic Buttons Design with CSS Cool Profile Card Design with HTML CSS Neumorphic Search Bar Design with HTML and CSS Simple Login Form with Placeholder Animation Pure CSS Button with Folded Corner Background Color Change Slider with HTML CSS and JavaScript 404 Page Not Found Template Design with HTML and CSS Movies Blog Card Design with HTML and CSS Simple CSS Border Animation with before and after Selector Custom Social Select Dropdown Menu with CSS and JavaScript Facebook Offline and Online Notification with CSS and JS New Year 2022 Text Animation with CSS and JS Change Placeholder Color using CSS Custom Select Tag DropDown with CSS and JavaScript Simple Price Range Slider With HTML CSS and JavaScript Profile Card With Hover Effect using HTML and CSS Circle With Two Colors using CSS Simple FAQ Accordion With HTML CSS and JavaScript