.line { border-bottom: 2px solid #E40012; 0px; display: inline-block; height: 2px; margin-bottom: 6px; } .animation-box:hover .line { animation: test 0.5s linear; animation-fill-mode :forwards; } @-webkit-keyframes test { 0%{ 5px; } 20%{ 10px; } 40%{ 15px; } 60%{ 20px; } 80%{ 25px; } 100%{ 30px; } }