0
I’m creating a website, and I wish there was a "button" with the Whatsapp icon on it, and by hovering the mouse over that button, it expanded and showed the number I put there. Currently the code is like this:
HTML:
<div id="whatsapp"></div>
<div id="whatsnumber">(99)99999-9999</div>
CSS:
#whatsapp{
position:fixed;
width:40px;
height:40px;
margin-top:calc(50vh - 55px);
background:url(img/whatsapp.png);
background-color: #25D366;
background-position: center center;
background-size: cover;
}
#whatsapp:hover{
width:50px;
transition-duration: 0.2s;
}
#whatsnumber{
display:none;
font-size:2rem;
position: fixed;
margin-top:calc(50vh - 55px);
margin-left: 40px;
width:max-width;
height:40px;
background: #25D366;
line-height: 40px;
border-right: 10px solid #25D366;
color: white;
}
#whatsapp:hover ~ #whatsnumber{
display: block;
}
#whatsnumber:hover{
display: block;
}
#whatsapp:not(hover){
width:40px;
transition-duration: 0.2s;
}
The idea is that there are two Divs, one (#Whatsapp) that when passing the mouse over will expand, and another (#whatsnumber) that when passing the mouse over should wait a second and then appear.
I tried using Transition-delay to make "display:block" take effect after a second, but it’s not working.
How to solve?
Would you like a way to increase your div by going over it?
– Luiz Santos