I have a navbar, yet whenever I hover the top and bottom are always enlarged. If I add height=100px
it still doesn’t change.
#navbar {
display: flex;
justify-content: space-between;
}
.nav {
margin: 1px auto;
padding: 2px 6px;
}
.nav:hover {
background-color: #84a98c;
}
<div id="navbar">
<div class="nav">
<h3>Home</h3>
</div>
<div class="nav">
<h3>About</h3>
</div>
<div class="nav">
<h3>Tools</h3>
</div>
<div class="nav">
<h3>Contact</h3>
</div>
</div>
2
Answers
simply adjust the padding-top
Code
I am not sure if you wanted it that way but here is how I made it: