How to create a vertical menu with CSS?

Following is the code to produce a vertical menu with CSS −


 Live Demo

<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
.Menu {
   width: 200px;
.links {
   background-color: rgb(251, 255, 188);
   color: black;
   display: block;
   padding: 12px;
   text-decoration: none;
.links:hover {
   background-color: rgb(85, 85, 85);
.links.selected {
   background-color: rgb(0, 0, 0);
   color: white;
<div class="Menu">
<a href="#" class="links selected">About Us</a>
<a class="links" href="#">Social Links</a>
<a class="links "href="#">Visit Us</a>
<a class="links" href="#">More info</a>
<a class="links" href="#">Phone Number</a>


The above code will produce the following output −