The Ripple effect is the most commonly used effect on websites and applications. Also, this effect makes our website more liquid and makes it feel elegant. We can easily apply the Ripple effect on any element of a website using CSS.
Here we have given an example on how to create a ripple effect on a button element.
The given below code is having the onhover ripple effect applied on the button.
<!DOCTYPE html>
<html>
<head>
<title>Ripple effect on button</title>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.4/css/all.css" integrity="sha384-DmABxgPhJN5jlTwituIyzIUk6oqyzf3+XuP7q3VfcWA2unxgim7OSSZKKf0KSsnh" crossorigin="anonymous">
<style>
button{
display: block;
margin: auto;
height: 50px;
width: 50px;
font-size: 32px;
text-align: center;
padding: 8px 0;
background-color: #1a237e;
color: #fff;
border: none;
border-radius: 100%;
}
.ripple:after{
content: '';
height: 50px;
top: -45px;
position: relative;
border-radius: 50%;
display: block;
background-color: #1a237e;
z-index: -1;
}
.ripple:hover::after{
-webkit-animation: ripple 1.5s ease-out;
-moz-animation: ripple 1.5s ease-out;
-ms-animation: ripple 1.5s ease-out;
-o-animation: ripple 1.5s ease-out;
animation: ripple 1.5s ease-out;
}
@keyframes ripple{
0%{
width: 50px;
height: 50px;
opacity: 1;
transform: translate(0px, 0px);
}
100%{
width: 100px;
height: 100px;
opacity: 0;
transform: translate(-25px, -25px);
}
}
</style>
</head>
<body>
<button class="ripple"><i class="fa fa-plus"></i></button>
</body>
</html> Explanation
Read Also: How to Create Ripple Effect Loader Using CSS
Now you can try the ripple effect on any button. You can also try the ripple effect on other elements to create a material HTML theme with a classic look and soft texture.
I hope you found this post informative.
Enjoy Coding 🙂
Â
There is a reason big-name companies like CNN use WordPress. WordPress is a popular content…
In this tutorial, I'm going to show you how to install MySQL on your computer.…
Download Turbo C++ for windows 10 in just 7 Mb and run your first C++…
We can redirect any webpage to any other or redirect the whole domain or website…
There are lots of methods to redirect pages, like refresh-redirect from META tag, redirect from…
Include files in PHP are used in appending various global or config files. We can…