user6408005 user6408005 - 5 months ago 10
CSS Question

fill whole box css html

i try to create navigation menu when i hover on item then look like box fill half with white color but i want to fill this whole 'li' with white color .. i draw white lines on paint to determine what i fill

image

code

.lefttabs
{
background-color:#1E1E1E;
color:White;
font-family:Calibri;
font-weight:bold;
font-size:medium;

width: 300px;
height: 100%;
z-index:1;/* Stay on top */
padding-top: 60px;
/* Place content 60px from the top */
transition: 0.5s; /* 0.5 second transition effect to slide in the sidenav */
}
.lefttabs a {


font-size: 25px;
color: #818181;
display: block;
transition: 0.3s;
font-size:medium;
color:White;
width: 133px;
margin-left: 0px;


padding: 8px;
text-decoration: none;

line-height: 24px;


}
.lefttabs ul
{
list-style:none;
margin:0px 20px 0px 0px;
border:1 px solid;




}
.lefttabs li
{
list-style:none;



}
.lefttabs li a
{
list-style:none;
display:block;
padding: 0px 0px 30px 0px;
padding-left: 10px;
padding-top: 10px;


}
.lefttabs a:hover
{

background-color:White;
color:Black;
}
.imga
{

width: 40px;
height: 30px;
margin-left: -21px;
margin-right: 20px;

}
.lefttabs a imga{
margin:0 8px 0 0;
vertical-align: middle; /* needed */
}


html

<div class="lefttabs">
<ul >
<li>
<a href=""><img class="imga" alt="dashboard" src="images/eve.bmp" border="0" />DASHBOARD</a>

</li>
<li>
<a href=""> <img class="imga" alt="Events" src="images/eve.bmp" border="0" />EVENTS</a>
</li>
<li>
<a href=""> <img class="imga" alt="Vehicles" src="images/ve.bmp" border="0" />VEHICLES</a>
</li>

Answer

Try this

.lefttabs {
  background-color: #1E1E1E;
  color: White;
  font-family: Calibri;
  font-weight: bold;
  font-size: medium;
  width: 300px;
  height: 100%;
  z-index: 1;
  /* Stay on top */
  padding-top: 60px;
  /* Place content 60px from the top */
  transition: 0.5s;
  /* 0.5 second transition effect to slide in the sidenav */
}
.lefttabs a {
  font-size: 25px;
  color: #818181;
  display: block;
  transition: 0.3s;
  font-size: medium;
  color: White;
  width: 133px;
  margin-left: 0px;
  padding: 8px;
  text-decoration: none;
  line-height: 24px;
}
.lefttabs ul {
  list-style: none;
  margin: 0px;
  border: 1px solid;
  /* not border:1 px solid*/
  padding: 0;
  /* add this*/
}
.lefttabs li {
  list-style: none;
}
.lefttabs li a {
  list-style: none;
  display: block;
  padding: 10px 0px 30px 10px;
  /*padding-left: 10px;*/
  /*padding-top: 10px;*/
  width: 100%;
  /*add this*/
}
.lefttabs a:hover {
  background-color: White;
  color: Black;
}
.imga {
  width: 40px;
  height: 30px;
  float: left;
  margin-right: 20px;
}
.lefttabs a imga {
  margin: 0 8px 0 0;
  vertical-align: middle;
  /* needed */
}
<div class="lefttabs">
  <ul>
    <li>
      <a href="">
        <img class="imga" alt="dashboard" src="images/eve.bmp" border="0" />DASHBOARD
      </a>

    </li>
    <li>
      <a href="">
        <img class="imga" alt="Events" src="images/eve.bmp" border="0" />EVENTS
      </a>
    </li>
    <li>
      <a href="">
        <img class="imga" alt="Vehicles" src="images/ve.bmp" border="0" />VEHICLES
      </a>
    </li>
  </ul>
</div>

Comments