Beispiel:HTML-Scroll-Snap-1.html

Aus SELFHTML-Wiki
Wechseln zu: Navigation, Suche

<!doctype html> <html lang="de"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>CSS Scroll Snap – Horizontale Bildergalerie</title> <style>

.gallery { width: 90%;

   display: flex;
   margin: 2em auto;
   padding: 0 1em;
   background: #04191b;
   overflow-y: hidden;
   scroll-snap-type: x mandatory;
 -webkit-overflow-scrolling: touch; /* Important for iOS devices */

}

.gallery img {

   margin: 1em;

padding: 1em; border-radius:0.5em; width: 30em; aspect-ratio: 4/3;

   scroll-snap-align: center;

}


body { max-width:60em; border: thin dotted; }

</style> </head>

<body>

Bildergalerie mit Scroll Snap ohne JS

</body> </html>