The content on this website, including videos and code examples, is for educational purposes only. All demonstrations and designs are fictional and created to illustrate coding techniques. Any resemblance to existing websites or brands is purely coincidental.
The creators and administrators of this website do not claim ownership or affiliation with any existing websites or companies. Users are encouraged to use the information responsibly for learning purposes. Liability for any misuse of the content provided is not accepted.
Below is the html code for this video.
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Creative Button Artistry</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<button class="hover-effect-btn">Hover Effect Button</button>
<button class="click-bubble-btn">Click Bubble Button</button>
<script src="index.js"></script>
</body>
</html>
Below is the css code for this video.
style.css
* {
margin: 0;
padding: 0;
}
body {
display: flex;
height: 100vh;
width: 100%;
background: #16161d;
justify-content: space-evenly;
align-items: center;
overflow: hidden;
}
button {
position: relative;
background: transparent;
color: #ffffff;
border: none;
font-size: 18px;
padding: 15px 30px;
outline: none;
cursor: pointer;
}
.hover-effect-btn {
background: #44000b;
border-radius: 100px;
overflow: hidden;
}
.hover-effect-btn::before {
--size: 0;
content: "";
position: absolute;
top: var(--y);
left: var(--x);
height: var(--size);
width: var(--size);
background: radial-gradient(circle closest-side, #f56564, transparent);
transform: translate(-50%, -50%);
transition: height 0.25s ease, width 0.25s ease;
}
.hover-effect-btn:hover::before {
--size: 280px
}
.click-bubble-btn {
display: inline-block;
background-color: #5d8aa8;
border-radius: 4px;
box-shadow: 0 2px 25px #9bddff40;
transition: all 0.25s ease;
}
.click-bubble-btn:focus {
outline: none;
}
.click-bubble-btn::before, .click-bubble-btn::after {
content: "";
position: absolute;
display: none;
left: -20%;
height: 100%;
width: 140%;
background-repeat: no-repeat;
z-index: -1000%;
transition: all 1s ease-in-out;
}
.click-bubble-btn::before {
top: -75%;
background-image: radial-gradient(circle, #5d8aa8 20%, transparent 20%),
radial-gradient(circle, transparent 20%, #5d8aa8 20%, transparent 30%), radial-gradient(circle, #5d8aa8 20%, transparent 20%),
radial-gradient(circle, #5d8aa8 20%, transparent 20%), radial-gradient(circle, transparent 10%, #5d8aa8 15%, transparent 20%),
radial-gradient(circle, #5d8aa8 20%, transparent 20%), radial-gradient(circle, #5d8aa8 20%, transparent 20%),
radial-gradient(circle, #5d8aa8 20%, transparent 20%), radial-gradient(circle, #5d8aa8 20%, transparent 20%);
background-size: 10% 10%, 20% 20%, 15% 15%, 20% 20%, 18% 18%, 10% 10%, 15% 15%, 10% 10%, 18% 18%;
}
.click-bubble-btn::after {
bottom: -75%;
background-image: radial-gradient(circle, #5d8aa8 20%, transparent 20%), radial-gradient(circle, #5d8aa8 20%, transparent 20%),
radial-gradient(circle, transparent 10%, #5d8aa8 15%, transparent 20%),
radial-gradient(circle, #5d8aa8 20%, transparent 20%), radial-gradient(circle, #5d8aa8 20%, transparent 20%),
radial-gradient(circle, #5d8aa8 20%, transparent 20%), radial-gradient(circle, #5d8aa8 20%, transparent 20%);
background-size: 15% 15%, 20% 20%, 18% 18%, 20% 20%, 15% 15%, 10% 10%, 20% 20%;
}
.click-bubble-btn:active {
transform: scale(0.9);
}
.click-bubble-btn.animate::before {
display: block;
animation: topBubblesAnim 1s ease-in-out forwards;
}
@keyframes topBubblesAnim {
0% {
background-position: 5% 90%, 10% 90%, 10% 90%, 15% 90%, 25% 90%, 25% 90%, 40% 90%, 55% 90%, 70% 90%;
}
50% {
background-position: 0% 80%, 0% 20%, 10% 40%, 20% 0%, 30% 30%, 22% 50%, 50% 50%, 65% 20%, 90% 30%;
}
100% {
background-position: 0% 70%, 0% 10%, 10% 30%, 20% -10%, 30% 20%, 22% 40%, 50% 40%, 65% 10%, 90% 20%;
background-size: 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%;
}
}
.click-bubble-btn.animate::after {
display: block;
animation: bottomBubblesAnim 1s ease-in-out forwards;
}
@keyframes bottomBubblesAnim {
0% {
background-position: 10% -10%, 30% 10%, 55% -10%, 70% -10%, 85% -10%, 70% -10%, 70% 0%;
}
50% {
background-position: 0% 80%, 20% 80%, 45% 60%, 60% 100%, 75% 70%, 95% 60%, 105% 0%;
}
100% {
background-position: 0% 90%, 20% 90%, 45% 70%, 60% 110%, 75% 80%, 95% 70%, 110% 10%;
background-size: 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%;
}
}
Below is the javascript code for this video.
index.js
document.querySelector(".hover-effect-btn").onmousemove = e => {
const y = e.pageY - e.target.offsetTop;
const x = e.pageX - e.target.offsetLeft;
e.target.style.setProperty("--y", `${y}px`);
e.target.style.setProperty("--x", `${x}px`);
};
var animateBtn = function (e) {
e.target.classList.add('animate');
setTimeout(function () { e.target.classList.remove('animate'); }, 1000);
}
var bubblyButtons = document.getElementsByClassName("click-bubble-btn");
for (let i = 0; i < bubblyButtons.length; i++) { bubblyButtons[i].addEventListener("click", animateBtn); }
Thanks for visiting