Creative fluid pure CSS button with animation

  • Last updated: Nov 3, 2023
  • Views: 154
  • Author: Admin
Creative fluid pure CSS button with animation

Hello colleagues.

In today's article, I will show you how to create a creative liquid button with animation using pure html and css without using javascript code.

 

HTML Code:

<body>
    <a href="#">
        <span>Button</span>
        <div class="liquied"></div>
    </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: #F0F1F5;
}

a {
    position: relative;
    padding: 20px 50px;
    display: block;
    text-decoration: none;
    text-transform: uppercase;
    width: 220px;
    overflow: hidden;
}

a span {
    position: relative;
    z-index: 1;
    color: #ffffff;
    font-size: 20px;
    letter-spacing: 9px;
}

a .liquied {
    position: absolute;
    left: 0;
    top: -90px;
    width: 220px;
    height: 200px;
    background-color: #2980B9;
    box-shadow: inset 0 0 50px #34495E;
    transition: 0.5s;
}

a .liquied:hover{
    top: -130px;
}

a .liquied:before,
a .liquied:after {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    top: 0;
    left: 50%;
    transform: translate(-50%, -75%);
}

a .liquied:before{
    border-radius: 45%;
    background: rgba(20, 20, 20, 1);
    animation: animate-button 5s linear infinite;
}

a .liquied:after{
    border-radius: 40%;
    background: rgba(20, 20, 20, 0.5);
    animation: animate-button 5s linear infinite;
}

@keyframes animate-button {
    0%{
        transform: translate(-50%, -75%) rotate(0deg);
    }
    100%{
        transform: translate(-50%, -75%) rotate(360deg);
    }
}

 

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