Bubble Animation Using HTML CSS
Bubble Animation Using HTML CSS WITH SOURCE CODE
IMAGE-
HTML SOURCE CODE
SAVE AS- INDEX.HTML
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="bubble.css" />
<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>Bubble animation</title>
</head>
<body>
<div class="hero">
<div class="navbar">
<h4>Bubble Animation</h4>
<button type="button">Sign Up</button>
</div>
<div class="content">
<small>Welcome to</small>
<h1>
Gaurav Tripathi <br />
Creative Studio
</h1>
<button type="button">Take a tour</button>
</div>
<div class="slide-bar">
<img src="images/menu.png" alt="" class="menu" />
<div class="social-links">
<img src="images/fb.png" alt="" />
<img src="images/ig.png" alt="" />
</div>
<div class="useful-links">
<img src="images/share.png" alt="" />
<img src="images/info.png" alt="" />
</div>
</div>
<div class="bubbles">
<img src="images/bubble.png" alt="" /><img
src="images/bubble.png"
alt=""
/><img src="images/bubble.png" alt="" /><img
src="images/bubble.png"
alt=""
/><img src="images/bubble.png" alt="" /><img
src="images/bubble.png"
alt=""
/><img src="images/bubble.png" alt="" />
<img src="images/bubble.png" alt="" />
</div>
</div>
</body>
</html>
CSS SOURCE CODE
SAVE AS - BUBBLE.CSS
* {
margin: 0;
padding: 0;
font-family: sans-serif;
letter-spacing: 3px;
}
body {
color: white;
height: 100vh;
width: 100%;
overflow: hidden;
}
.hero {
width: 100%;
height: 100vh;
background-image: url("images/background.png");
background-size: cover;
background-position: center;
position: relative;
overflow: hidden;
}
.logo {
width: 100px;
cursor: pointer;
}
.navbar {
width: 85%;
height: 15%;
margin: auto;
display: flex;
align-items: center;
justify-content: space-between;
}
button {
color: #fbfcfd;
padding: 10px 25px;
background: transparent;
border: 1px solid white;
border-radius: 20px;
outline: none;
cursor: pointer;
}
.content {
color: #fbfcfd;
position: absolute;
top: 50%;
left: 8%;
transform: translateY(-50%);
z-index: 2;
}
h1 {
/* width: 95%; */
font-size: 4rem;
margin: 10px 0 30px;
line-height: 80px;
letter-spacing: 15px;
}
.slide-bar {
width: 50px;
height: 100vh;
background: linear-gradient(#00545d, #000729);
position: absolute;
right: 0;
top: 0;
}
.menu {
display: block;
width: 25px;
margin: 40px auto 0;
cursor: pointer;
}
.social-links img {
width: 25px;
margin: 5px auto;
cursor: pointer;
}
.useful-links img {
width: 25px;
margin: 5px auto;
cursor: pointer;
}
.social-links {
width: 50px;
text-align: center;
position: absolute;
top: 50%;
transform: translateY(-50%);
}
.useful-links {
width: 50px;
text-align: center;
position: absolute;
bottom: 30px;
/* transform: translateY(-50%); */
}
.bubbles img {
width: 50px;
animation: bubble 7s linear infinite;
}
.bubbles {
width: 100%;
display: flex;
align-items: center;
justify-content: space-around;
position: absolute;
bottom: -70px;
}
@keyframes bubble {
0% {
transform: translateY(0);
opacity: 0;
}
50% {
opacity: 1;
}
70% {
opacity: 1;
}
100% {
transform: translateY(-80vh);
opacity: 0;
}
}
.bubbles img:nth-child(1) {
animation-delay: 2s;
width: 25px;
}
.bubbles img:nth-child(2) {
animation-delay: 1s;
}
.bubbles img:nth-child(3) {
animation-delay: 3s;
width: 25px;
}
.bubbles img:nth-child(4) {
animation-delay: 4.5s;
}
.bubbles img:nth-child(5) {
animation-delay: 3s;
}
.bubbles img:nth-child(6) {
animation-delay: 6s;
width: 20px;
}
.bubbles img:nth-child(7) {
animation-delay: 7s;
width: 35px;
}
.bubbles img:nth-child(8) {
animation-delay: 7s;
width: 30px;
}
footer {
font-size: 15px;
position: absolute;
bottom: 0;
color: white;
}
@media (max-width: 800px) {
.slide-bar {
display: none;
}
h1 {
font-size: 4rem;
width: 100%;
line-height: 60px;
letter-spacing: 15px;
}
}
Comments
Post a Comment