How to create a vertical menu with CSS?

CSSWeb DevelopmentFront End Technology

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

Example

 Live Demo

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
<style>
.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);
   color:white;
}
.links.selected {
   background-color: rgb(0, 0, 0);
   color: white;
}
</style>
</head>
<body>
<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>
</div>
</body>
</html>

Output

The above code will produce the following output −

raja
Published on 03-Apr-2020 12:50:54
Advertisements