Toggle navigation
☰
HTML
CSS
Scripting
Database
<!doctype html> <title>Example</title> <style> body { display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; font-family: sans-serif; background-color: #333; } .kb-container { width: 600px; height: 400px; overflow: hidden; /* Critical to crop the scaling image */ position: relative; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); } .kb-image { width: 100%; height: 100%; /* Use a high resolution image so it doesn't pixelate when zoomed */ background-image: url('/pix/samples/22l.jpg'); background-size: cover; background-position: center; /* Ensure scaling originates from roughly the center so it feels like a slow push in. */ transform-origin: 50% 50%; animation: ken-burns 15s ease-out infinite alternate; } /* The classic effect scales slowly up and pans slightly. Notice we scale to 1.2 (120%) over 15 seconds. */ @keyframes ken-burns { 0% { transform: scale(1) translate(0, 0); } 100% { transform: scale(1.2) translate(-20px, 10px); } } /* Optional Overlay Text */ .kb-text { position: absolute; bottom: 30px; left: 30px; color: white; font-size: 2rem; font-weight: bold; text-shadow: 2px 2px 4px rgba(0,0,0,0.8); margin: 0; } @media (prefers-reduced-motion: reduce) { .kb-image { animation: none; /* Just display a beautiful static image */ } } </style> <div class="kb-container"> <div class="kb-image"></div> <h2 class="kb-text">Explore the Wild</h2> </div>