CSS button with animated glowing effect

  • Last updated: Nov 3, 2023
  • Views: 182
  • Author: Admin
CSS button with animated glowing effect

Hello colleagues.

We create a beautiful button with an animated glowing effect using pure CSS without using JavaScript code.

 

HTML Code:

<body>
    <a href="#">Button</a>
</body>

 

CSS Code:

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #112233;
}

a {
    transform: translate(-50%, -50%);
    width: 300px;
    height: 80px;
    text-align: center;
    line-height: 80px;
    color: #ffffff;
    font-size: 25px;
    text-transform: uppercase;
    text-decoration: none;
    box-sizing: border-box;
    background: linear-gradient(90deg, #44BBFF, #EDD834, #FC575E, #44BBFF);
    background-size: 400%;
    border-radius: 10px;
    animation: button-animate 8s linear infinite;
}

@keyframes button-animate {
    0% {
        background-position: 0%;
    }
    100% {
        background-position: 400%;
    }
}

a:before {
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    background: linear-gradient(90deg, #44BBFF, #EDD834, #FC575E, #44BBFF);
    background-size: 400%;
    border-radius: 20px;
}

 

Thank you all, I hope my article was of some help to you.

SIMILAR ARTICLES

YII2 defaultRoute - How to change default controller in template

YII2 defaultRoute - How to change default controller in template

Pure HTML/CSS search bar

Pure HTML/CSS search bar

HTML/CSS - Expandable Searchbar Animation

HTML/CSS - Expandable Searchbar Animation