Back
Step-by-step guide to designing a mesmerizing pulsating button effect without JavaScript, using pure CSS animations.
<div class="button-wrapper"> <button class="pulse-button">Click Me</button> </div>
.button-wrapper { display: flex; justify-content: center; align-items: center; height: 100vh; background-color: #f0f0f0; }
.pulse-button { background-color: #6200ea; color: white; border: none; border-radius: 50px; padding: 15px 30px; font-size: 16px; cursor: pointer; transition: background-color 0.3s ease; position: relative; outline: none; }
.pulse-button::before { content: ''; position: absolute; width: 100%; height: 100%; border-radius: 50px; background-color: rgba(98, 0, 234, 0.6); top: 0; left: 0; z-index: -1; transition: transform 0.3s ease, opacity 0.3s ease; animation: pulse 2s infinite; }
@keyframes pulse { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }
.pulse-button:hover { background-color: #3700b3; }
<div class="button-wrapper"> <button class="pulse-button">Click Me</button> </div> <style> .button-wrapper { display: flex; justify-content: center; align-items: center; height: 100vh; background-color: #f0f0f0; } .pulse-button { background-color: #6200ea; color: white; border: none; border-radius: 50px; padding: 15px 30px; font-size: 16px; cursor: pointer; transition: background-color 0.3s ease; position: relative; outline: none; } .pulse-button::before { content: ''; position: absolute; width: 100%; height: 100%; border-radius: 50px; background-color: rgba(98, 0, 234, 0.6); top: 0; left: 0; z-index: -1; transition: transform 0.3s ease, opacity 0.3s ease; animation: pulse 2s infinite; } .pulse-button:hover::before { transform: scale(1.5); opacity: 0; } @keyframes pulse { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } } .pulse-button:hover { background-color: #3700b3; } </style>Thank you for reading this article.
Comments
No comments yet. Be the first to comment!