Perform Animation on background-position property with CSS

CSSWeb DevelopmentFront End Technology

Use the @keyframes to animate the background position. To implement animation on background-position property with CSS, you can try to run the following code


Live Demo

<!DOCTYPE html>
         div {
            width: 500px;
            height: 400px;
            background: yellow;
            background-image: url('');
            animation: myanim 3s infinite;
            background-position: bottom left;
         @keyframes myanim {
            20% {
               background-color: maroon;
               background-position: bottom right;
Updated on 25-Jun-2020 11:30:34