How to Create: Vertical Menu
- Previous page Horizontal scrolling menu
- Next page Footer navigation
Learn how to use CSS to create a vertical menu.
How to Create a Vertical Button Group
Step 1 - Add HTML:
<div class="vertical-menu"> <a href="#" class="active">Home</a> <a href="#">Link 1</a> <a href="#">Link 2</a> <a href="#">Link 3</a> <a href="#">Link 4</a> </div>
Step 2 - Add CSS:
.vertical-menu { width: 200px; /* You can set the width if you wish */ } .vertical-menu a { background-color: #eee; /* Gray background color */ color: black; /* Black text color */ display: block; /* Display links one after another */ padding: 12px; /* Add some inner padding */ text-decoration: none; /* Remove the underline from the link */ } .vertical-menu a:hover { background-color: #ccc; /* Dark gray background when hovering over the mouse */ } .vertical-menu a.active { background-color: #04AA6D; /* Add green to the 'active/current' link */ color: white; }
Vertical Scrolling Menu
If you want a vertical scrolling menu, please set a specific height and add overflow
Properties:
.vertical-menu { width: 200px; height: 150px; overflow-y: auto; }
Related pages
- Previous page Horizontal scrolling menu
- Next page Footer navigation