3d Parallax Image - MeggiTools
Run
Toggle Theme
Share Link
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>3D Parallax Image</title> <style> body { display: flex; justify-content: center; align-items: center; height: 100vh; background: #e0e0e0; margin: 0; font-family: Arial, sans-serif; perspective: 1000px; } .parallax-container { position: relative; width: 300px; height: 400px; perspective: 1000px; transform-style: preserve-3d; overflow: hidden; } .parallax { position: absolute; width: 100%; height: 100%; transform: translateZ(0); transition: transform 0.5s ease-in-out; } .parallax img { width: 100%; height: 100%; object-fit: cover; transform: translateZ(0) scale(1.5); transition: transform 0.5s ease-in-out; } .parallax:nth-child(1) { left: -10%; top: -10%; } .parallax:nth-child(2) { left: 10%; top: 10%; } .parallax:nth-child(3) { left: -5%; top: -20%; } .parallax:nth-child(4) { left: 15%; top: 5%; } .parallax:hover { transform: translateZ(-50px); } .parallax:hover img { transform: translateZ(-50px) scale(1.2); } </style> </head> <body> <div class="parallax-container"> <div class="parallax"><img src="https://via.placeholder.com/300x400" alt="Sample Image"></div> <div class="parallax"><img src="https://via.placeholder.com/300x400" alt="Sample Image"></div> <div class="parallax"><img src="https://via.placeholder.com/300x400" alt="Sample Image"></div> <div class="parallax"><img src="https://via.placeholder.com/300x400" alt="Sample Image"></div> </div> </body> </html>