Home / 3D and Depth / Floating Elements

Floating Elements CSS Template, Free with Live Demo

Free floating elements template for an app launch. UI cards gently hover around a CSS phone mockup with soft shadows and slow motion. Live demo. The example is Driftwood, a to-do app.

Open live demoDownload HTML fileView code on GitHub
Floating Elements CSS template example: Driftwood, a to-do app

What is floating elements?

Floating elements show pieces of your app hovering around a phone, as if they had lifted off the screen. Each one bobs slowly on its own timing, which makes the hero feel alive without being busy.

The phone is drawn in HTML and CSS, so the text inside is real. Each floating card shares one float animation with its own duration and delay, so they never move in sync.

Good for

  • Mobile app landing pages
  • SaaS feature highlights
  • Product launches
  • Waitlist pages

What you get in this template

The key CSS

This is the part that makes the floating elements look work. Copy it into your own project.

.fl {
  position: absolute;
  border-radius: 18px;
  box-shadow: 0 20px 40px rgba(18, 48, 43, .14);
  animation: float 6s ease-in-out infinite;
}
.f2 { animation-duration: 7s; }
.f3 { animation-duration: 8s; animation-delay: -3s; }
@keyframes float { 50% { transform: translateY(-16px) rotate(1.5deg); } }

How to use it

  1. Click Download HTML file above.
  2. Open the file in any code editor, like VS Code.
  3. Change the text, colors and links to match your project. Colors are at the top of the style tag.
  4. Upload it to any host, such as GitHub Pages, Netlify or your own server. It is one file with no build step.

Questions people ask

How do you make elements float in CSS?

Animate a small translateY up and down with ease-in-out, for example translateY(-16px) at 50%, and loop it forever.

How do I stop them moving together?

Give each element a different animation-duration and a negative animation-delay so they start at different points.

Can I put a real screenshot in the phone?

Yes. Replace the list inside .phone with an img of your app screen.

More 3D and Depth designs