I am working with two images, but I only want to display one at a time. When I hover over the image, I want it to change.
.sidenav {
height: 100%;
/* 100% Full-height */
width: 100px;
position: fixed;
/* Stay in place */
z-index: 2;
top: 0;
left: 0;
background-color: #fff;
overflow: hidden;
/* Disable horizontal scroll */
padding-top: 20px;
transition: 0.8s;
opacity: 0.8;
box-shadow: 0px 20px 50px black;
}
.sidenav:hover {
width: 215px;
transition: 0.8s;
overflow: hidden;
}
.sidenav img {
height: 10%;
width: auto;
padding-left: 13px;
transition: 0.8s;
}
.hovered {
visibility: hidden;
opacity: 0;
height: 13% !important;
transition: 0.5s;
}
.sidenav:hover img:first-child {
visibility: hidden;
opacity: 0;
}
.sidenav:hover .hovered {
visibility: visible;
opacity: 1;
}
<div class="sidenav">
<img src="../img/10.png">
<img src="../img/logo1.png" class="hovered">
</div>
For my current project, I am trying to figure out how to hide the second image element without leaving a blank space. I have avoided using display: none;
due to the transition effect. Can anyone provide a suggestion or solution? Thank you in advance.