Search This Blog

Wednesday, 28 August 2024

Bouncing ball animation with CSS

HTML:
<div class="ball"></div>


CSS:

        .ball {
            width: 25px;
            height: 25px;
            background-color: #61dafb;
            border-radius: 50%;
            position: relative;
            animation: bounce 2s infinite ease-in-out;
        }
        
        @keyframes bounce {
            0%, 100% {
                transform: translateY(0);
            }
            50% {
                transform: translateY(-100px);
            }
        }



No comments:

Post a Comment