My header looks like this:
If I hover over it, it increases slightly, to this:
What property needs to be changed in the CSS so that on-hovering it takes the entire height of the blue bar? I tried using width since I am using border-box, I thought the size of the blue bar wont change but it did.
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
background-image: url(background.jpg);
background-size: cover;
background-position: center;
font-family: sans-serif;
}
.menu-bar {
background: rgb(3, 50, 112);
text-align: center;
}
.menu-bar ul {
display: inline-flex;
list-style: none;
color: #fff;
}
.menu-bar ul li {
width: 120px;
margin: 15px;
padding: 0px;
}
.menu-bar ul li a {
text-decoration: none;
color: white;
}
.active,
.menu-bar ul li:hover {
background-color: #2bab0b;
border-radius: 3px;
}
<link rel="stylesheet1" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.1.1/css/fontawesome.min.css">
<div class="menu-bar">
<ul>
<li class="active"><a href="#">Home</a></li>
<li><a href="#">About us</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Investors</a></li>
<li><a href="#">Pricing</a></li>
<li><a href="#">Training </a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
Edit :
As was suggested in the comment. I included height:30px; in the hover class as including it in menu-bar class did not seem to work. However what seems to be happening is that the size of green highlight is increasing while and the size of the blue bar:


