HTML & CSS - Hover state maintained after transition
Simple example for StackOverflow
HTML
<div id="container">
<div id="wrapper">
<div id="content">Hover me !</div>
</div>
</div>
CSS
/** The problem **/
#wrapper:hover #content {
background-color: deepskyblue;
transform:translateY(300px);
-webkit-transform: translateY(300px);
}
/** Just for fun **/
html, body {
height: 100%;
overflow: hidden;
}
#container {
width: 80%;
height: 80%;
background: beige;
border: 1px solid black;
border-radius: 5px;
margin: 10px auto;
padding: 10px;
}
#wrapper {
width: 122px;
height: 122px;
margin: 10px auto;
}
#content {
display: flex;
align-items: center;
justify-content: center;
width: 100px;
height: 100px;
background: coral;
border: 1px solid black;
border-radius: 5px;
padding: 10px;
cursor: pointer;
transition: 1s 500ms;
transition-property: transform, background-color;
}