What I have I have 1 parent div containing 2 div's of bg-color green and orange, I animated so that when I hover over them they get bg-color red for duration 1s, for now everything works fine.
what I need When I hover, it nicely animates for 1s, but when I move mouse from div's it immediately comes to original styles, but I need them to take 2s to revert back to original styles when I move mouse away from that elements
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
}
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.fst--row {
width: 80rem;
height: 20rem;
display: flex;
gap: 0.7rem;
}
.fst--row>div {
width: 50%;
height: 100%;
}
.fst--row>div:nth-child(1) {
background-color: #099268;
}
.fst--row>div:nth-child(2) {
background-color: #e67700;
}
.fst--row>div:hover {
animation: hover--flex 1s forwards;
}
@keyframes hover--flex {
to {
background-color: red;
}
}
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="flexLaying.css">
</head>
<body>
<div class="fst--row">
<div></div>
<div></div>
</div>
</body>
</html>