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 http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Buttons with Gradient Animation</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="container">
<button class="btn-1">
<span class="btn-bg"></span>
<span class="btn-text-container">
<span class="btn-text text-fire">Fire</span>
<span class="btn-text text-fire-extinguisher">Fire Extinguisher</span>
</span>
</button>
<div class="btn-2">
<span class="btn-bg-2"></span>
<span class="btn-text-2">Button 2</span>
</div>
</div>
</body>
</html>
Below is the css code for this video.
style.css
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
width: 100%;
height: 100vh;
background-color: #101010;
}
.container {
display: flex;
justify-content: space-around;
align-items: center;
width: 80%;
height: 100vh;
position: relative;
}
.btn-1 {
display: flex;
justify-content: center;
align-items: center;
width: 200px;
height: 100px;
position: relative;
border: none;
border-radius: 8px;
background: transparent;
overflow: hidden;
cursor: pointer;
transition: all 0.25s ease;
}
.btn-1:focus .btn-bg::before, .btn-1:focus-within .btn-bg::before, .btn-1:hover .btn-bg::before {
filter: blur(50px) hue-rotate(270deg);
}
.btn-1:focus .btn-bg::after, .btn-1:focus-within .btn-bg::after, .btn-1:hover .btn-bg::after {
filter: blur(50px) hue-rotate(180deg);
}
.btn-1:focus .btn-text-container, .btn-1:focus-within .btn-text-container, .btn-1:hover .btn-text-container {
transform: scale(0.9);
}
.btn-1:focus .btn-text-container .text-fire, .btn-1:focus-within .btn-text-container .text-fire,
.btn-1:hover .btn-text-container .text-fire {
transform: scale(0.25);
opacity: 0;
}
.btn-1:focus .btn-text-container .text-fire-extinguisher, .btn-1:focus-within .btn-text-container .text-fire-extinguisher,
.btn-1:hover .btn-text-container .text-fire-extinguisher {
transform: scale(1);
opacity: 1;
}
.btn-bg {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 200%;
height: 400px;
position: absolute;
top: -75%;
left: -50%;
animation: rotatingBgAnim 4s linear infinite;
transition: all 0.5s ease;
}
.btn-bg::before, .btn-bg::after {
content: "";
width: 100%;
height: 50%;
filter: blur(50px);
transition: all 1s ease;
}
.btn-bg::before {
background: linear-gradient(45deg, #5ebac9, #cf1920);
}
.btn-bg::after {
background: linear-gradient(135deg, #fb8b23, #ffbd2e);
}
.btn-text-container {
display: flex;
justify-content: center;
align-items: center;
background: #ffffff;
width: calc(100% - 20px);
height: calc(100% - 20px);
position: absolute;
border-radius: 4px;
mix-blend-mode: screen;
transition: all 1s ease;
}
.btn-text {
position: absolute;
font-size: 25px;
}
.text-fire {
opacity: 1;
transition: all 1s ease;
}
.text-fire-extinguisher {
transform: scale(0.25);
transition: all 1s ease;
opacity: 0;
}
@keyframes rotatingBgAnim {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.btn-2 {
position: relative;
display: inline-flex;
border: none;
width: 200px;
height: 50px;
cursor: pointer;
}
.btn-text-2 {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
background: #000000;
color: #ffffff;
border-radius: 4px;
display: flex;
justify-content: center;
align-items: center;
font-size: 25px;
line-height: 50px;
}
.btn-bg-2 {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
border-radius: 4px;
background: linear-gradient(225deg, #7492b9, #def7e7, #d8bfd8, #953553, #d8bfd8, #def7e7, #7492b9);
background-size: 500% 100%;
border: none;
animation: bgAnim 2s ease-in-out infinite;
}
@keyframes bgAnim {
0%, 100% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
}
.btn-bg-2::after {
content: "";
position: absolute;
filter: blur(20px);
height: 100%;
background-size: inherit;
background-image: inherit;
animation: inherit;
left: 0;
right: 0;
top: 0;
bottom: 0;
}
Thanks for visiting