I have a side navigation bar in my application which consists of 4 nav items. On initial load, they should look like below -
On click of each item, the background of that item should be changed as below -
I have tried below code (with limited knowledge on CSS) and was able to get what was shown in first image. For second image It displays like this and it should done as in second image.
HTML
<div class="container">
<nav class="col-sm-3">
<ul class="nav nav-pills nav-stacked">
<li><a href="javascript:void(0);">Item 1</a></li>
<li><a href="javascript:void(0);">Item 2</a></li>
<li><a href="javascript:void(0);">Item 3</a></li>
<li><a href="javascript:void(0);">Item 4</a></li>
</ul>
</nav>
</div>
CSS
.nav-pills>li {
margin-left: -5px;
}
.nav-pills>li {
width: 90%;
}
.nav-pills>li>a{
color: #0D0D0D;
background-color: #e1e1e1;
padding: 15px;
}
.nav-pills>li>a:focus, .nav-pills>li>a:active{
/*background-color: white;*/
border: 30px solid lightgreen;
border-left: 30px solid transparent;
border-right: 0;
width: 100%;
}