<div class="bubble-bg">
<div class="bubble"></div>
<div class="bubble"></div>
<div class="bubble"></div>
<div class="bubble"></div>
<div class="center-content">
<h1>Floating Bubbles</h1>
</div>
</div>.bubble-bg {
font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
width: 100%;
height: 400px;
background: linear-gradient(120deg, #84fab0 0%, #8fd3f4 100%);
position: relative;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
border-radius: 12px;
}
.center-content {
z-index: 2;
color: #fff;
text-shadow: 0 2px 10px rgba(0,0,0,0.1);
font-size: 2rem;
}
.bubble {
position: absolute;
bottom: -100px;
background: rgba(255, 255, 255, 0.3);
border-radius: 50%;
animation: rise 10s infinite linear;
}
.bubble:nth-child(1) {
width: 80px;
height: 80px;
left: 10%;
animation-duration: 8s;
}
.bubble:nth-child(2) {
width: 40px;
height: 40px;
left: 20%;
animation-duration: 12s;
animation-delay: 2s;
}
.bubble:nth-child(3) {
width: 120px;
height: 120px;
left: 70%;
animation-duration: 15s;
animation-delay: 1s;
}
.bubble:nth-child(4) {
width: 60px;
height: 60px;
left: 85%;
animation-duration: 9s;
animation-delay: 4s;
}
@keyframes rise {
0% {
bottom: -100px;
transform: translateX(0);
}
50% {
transform: translateX(50px);
}
100% {
bottom: 108%;
transform: translateX(-50px);
}
}Nothing to show yetType HTML, CSS or JavaScript and your page appears here.
Click any element to find its code Esc
Check this code before you run it
It came from a shared link. It runs with fewer permissions, so it cannot open pop-ups, submit forms or start downloads.
0.00s / 0.00s
Nothing has animated yet. Hover, click or type in the preview and each CSS animation, transition or
element.animate() call shows up here as it plays.