I have implemented a hover animation to animate the div, but unfortunately, when I added the animation to #i :hover {}
, it ended up animating the words only. Moreover, the cursor transforms into a pointer solely when hovering over the words instead of the entire div.
@keyframes hover {
0% {bottom: 0px;}
100% {bottom: 20px;}
}
body {
display: flex;
justify-content: center;
align-items: center;
}
#i {
transition: 0.5s ease;
display: flex;
justify-content: center;
align-items: center;
background-color: rgb(255, 100, 0);
width: 200px;
height: 200px;
font-size: 50px;
text-align: center;
font-family: sans-serif;
border-radius: 10%;
}
#i:hover {
position: relative;
cursor: pointer;
animation: hover 0.5s;
bottom: 20px;
}
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<div id="i"><strong>Hover</strong></div>
</body>
</html>
Is there a way to modify it so that the entire div moves upwards on hover?