Edit This Code:
<!DOCTYPE html>
<html>
<head>
<style>
ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    width: 200px;
    background-color: #f1f1f1;
}


li a {
    display: block;
    color: #000;
    padding: 8px 0 8px 16px;
    text-decoration: none;
}


/* Change the link color on hover */
li a:hover {
    background-color: #555;
    color: white;
}

</style>
</head>
<body>

<h2>Vertical Navigation Bar</h2>

<ul>
  <li><a href="tryit.asp-filename=trycss_navbar_vertical_gray.html#home">Home</a></li>
  <li><a href="tryit.asp-filename=trycss_navbar_vertical_gray.html#news">News</a></li>
  <li><a href="tryit.asp-filename=trycss_navbar_vertical_gray.html#contact">Contact</a></li>
  <li><a href="tryit.asp-filename=trycss_navbar_vertical_gray.html#about">About</a></li>
</ul>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy