0

Css animation

Can someone please tell me how to write this animation so that it turns just the triangle yellow and then makes it stay yellow? https://code.sololearn.com/W3D4BSuD0TJP/?ref=app

6th Jan 2019, 10:53 PM
Zachary Burkholder
Zachary Burkholder - avatar
1 Answer
+ 3
Try this: .triangle { width: 0; height: 0; border-left: 70px solid transparent; border-right: 70px solid transparent; border-bottom: 70px solid green; margin-top: 220px; margin-left: 220px; position: absolute; animation: trngl 1s linear forwards; } @keyframes trngl { 0% {border-bottom-color: green;} 100% {border-bottom-color: yellow;} } EXPLANATION: You have to animate the border-bottom-color because that's green the triangle. To make the triangle remain yellow use the 'forward' value in the animation: https://www.w3schools.com/css/css3_animations.asp
6th Jan 2019, 11:11 PM
Ulisses Cruz
Ulisses Cruz - avatar