Hello, I’m currently trying to put a small image as a hover effect under a text in my navigation bar. However, I encountered a problem where only part of the image is shown when hovering over the text in the navigation bar. Can anyone tell me why this is happening? I’ve been trying to fix it for the past hour but can’t seem to find the right solution, I have tried increasing the padding , width of the function but still did not help the issue.
It seem like the hover works but there just isn’t enough space for it to show the full image when hovering over it. Is there anyway I could show the full image when hovering over the text?
The HTML code:
<nav>
<ul>
<li><a href="main.html"><i class="fa fa-home padicon"></i> Home</a></li>
<li><a href="profile.html"><i class="fas fa-store"></i> Shop</a></li>
<div class="alignright">
<li><a href="login.html"><i class="fas fa-user-circle"></i> Account</a></li>
</div>
</ul>
</nav>
The CSS code:
nav {
overflow: hidden;
padding-left: 50px;
padding-top: 15px;
}
ul {
list-style: none;
margin: 0;
padding: 0;
float: center;
}
nav li {
display: inline-block;
margin-left: 10px;
height: 50px;
line-height: 70px;
transition: 0.5s linear;
font-size:120%;
}
nav a {
text-decoration: none;
font-weight: 500;
color: #8cc540;
}
nav a:hover {
display: block;
background-image: url("pointer.png"); **(this is the image im trying to show when hovering over the text)**
background-repeat:no-repeat;
background-position: 15px 45px;
background-size: 25px 25px;
}
How it looks like currently and as you can see, the image (a carrot) is halved.