Here, we will learn how to create bubble background animation in html using css. It entreaties more people while enjoying a smooth interaction with your website. Also you can choose different color palette animations for this background. Follow the below snippet to create this.
<!DOCTYPE html>
<html lang="en">
<head>
<title>How to create bubble animation in html using css</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="section-class">
<h1>Bubbles Animation</h1>
<div><span class="dot"></span></div>
<div><span class="dot"></span></div>
<div><span class="dot"></span></div>
<div><span class="dot"></span></div>
<div><span class="dot"></span></div>
<div><span class="dot"></span></div>
<div><span class="dot"></span></div>
<div><span class="dot"></span></div>
<div><span class="dot"></span></div>
<div><span class="dot"></span></div>
<div><span class="dot"></span></div>
<div><span class="dot"></span></div>
<div><span class="dot"></span></div>
<div><span class="dot"></span></div>
<div><span class="dot"></span></div>
</div>
</body>
</html>
Add the below stylesheet into the html file to achieve the bubble animation.
html, body{
margin: 0;
padding: 0;
text-align: center;
}
.section-class {
height: 100%;
width: 100%;
background: linear-gradient(180deg, #FF7F50, 5%, #D2691E, 50%, #DC143C);
position: absolute;
}
.section-class h1 {
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
position: absolute;
font-family: sans-serif;
color: #fff;
font-size: 50px;
font-weight: 500;
text-transform: capitalize;
}
.section-class div {
height: 60px;
width: 60px;
border: 2px solid rgba(255, 255, 255, 0.7);
border-radius: 50px;
position: absolute;
top: 10%;
left: 10%;
animation: 4s linear infinite;
}
div .circle {
height: 5px;
width: 5px;
border-radius: 50px;
background: rgba(255, 255, 255, 0.5);
position: absolute;
top: 20%;
right: 20%;
}
.section-class div:nth-child(1) {
top: 20%;
left: 20%;
animation: animate 8s linear infinite;
}
.section-class div:nth-child(2) {
top: 60%;
left: 80%;
animation: animate 10s linear infinite;
}
.section-class div:nth-child(3) {
top: 40%;
left: 40%;
animation: animate 3s linear infinite;
}
.section-class div:nth-child(4) {
top: 66%;
left: 30%;
animation: animate 7s linear infinite;
}
.section-class div:nth-child(5) {
top: 90%;
left: 10%;
animation: animate 9s linear infinite;
}
.section-class div:nth-child(6) {
top: 30%;
left: 60%;
animation: animate 5s linear infinite;
}
.section-class div:nth-child(7) {
top: 70%;
left: 20%;
animation: animate 8s linear infinite;
}
.section-class div:nth-child(8) {
top: 75%;
left: 60%;
animation: animate 10s linear infinite;
}
.section-class div:nth-child(9) {
top: 50%;
left: 50%;
animation: animate 6s linear infinite;
}
.section-class div:nth-child(10) {
top: 45%;
left: 20%;
animation: animate 10s linear infinite;
}
.section-class div:nth-child(11) {
top: 10%;
left: 90%;
animation: animate 9s linear infinite;
}
.section-class div:nth-child(12) {
top: 20%;
left: 70%;
animation: animate 7s linear infinite;
}
.section-class div:nth-child(13) {
top: 20%;
left: 20%;
animation: animate 8s linear infinite;
}
.section-class div:nth-child(14) {
top: 60%;
left: 5%;
animation: animate 6s linear infinite;
}
.section-class div:nth-child(15) {
top: 90%;
left: 80%;
animation: animate 9s linear infinite;
}
@keyframes animate {
0% {
transform: scale(0) translateY(0) rotate(70deg);
}
100% {
transform: scale(1.3) translateY(-100px) rotate(360deg);
}
}
Popular Posts
- Show / Hide div based on dropdown selected using jQuery
- Autosuggestion Select Box using HTML5 Datalist, PHP and MySQL with Example
- Infinite Scrolling on PHP website using jQuery and Ajax with example
- Custom Authentication Login And Registration Using Laravel 8
- How to Convert MySQL Data to JSON using PHP
- Google Login or Sign In with Angular Application
- How to change date format in PHP?
- Image Lazy loading Using Slick Slider
- Slick Slider Basic With Example
- php in_array check for multiple values
- Adaptive Height In Slick Slider
- Slick Slider Center Mode With Example
- How to Scroll to an Element with Vue 3 and ?
- JavaScript Multiple File Upload Progress Bar Using Ajax With PHP
- Slick Slider Multiple Items With Example
Total Views: 553