Beispiel:Bildwechsler-2.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.0" >
  <link rel="stylesheet" media="screen" href="./Beispiel:SELFHTML-Beispiel-Grundlayout.css">
  <title>Bildwechsler mit CSS-animation 2</title>
  <style>
  
.gallery {
  position: relative;
  margin:0;
  background: none;
  border: none;
}
 
.gallery figure {
  position: absolute;
  display: inline-block;
  top: 0;
  left: 2em;
  z-index: 1;
  animation: wechseln 15s infinite;
}

.gallery figure:last-of-type {
  position: relative;
}
 
.gallery > figure figcaption {
  position: absolute;
  left: 1em;
  font-size: 2em;
  font-weight: bold;
  bottom: 0.5em;
  z-index: 2;
  color: white;
}

@keyframes wechseln {
    0% {opacity: 0;}
   20% {opacity: 1;}
   40% {opacity: 1;}
   60% {opacity: 0;}
  100% {opacity: 0;}
}

.gallery figure:nth-of-type(2) {
  animation-delay: 5s;
  opacity: 0;
}

.gallery figure:nth-of-type(3) {
  animation-delay: 10s;
  opacity: 0;
}
  </style>
</head>
<body>
  <h1>Bildwechsler mit CSS-animation 2</h1>
  <h2>Ein Tag in Nürnberg</h2>
    <figure class="gallery">
      <figure>
        <img src="//wiki.selfhtml.org/images/5/58/Burg-in-N%C3%BCrnberg-1.jpg" alt="Blick auf Kaiserburg am Morgen- eigene Aufnahme">
        <figcaption>morgens</figcaption>
      </figure>
      <figure>
        <img src="//wiki.selfhtml.org/images/b/b9/Burg-in-N%C3%BCrnberg-2.jpg" alt="Blick auf Kaiserburg in der Mittagszeit - eigene Aufnahme">
        <figcaption>mittags</figcaption>
      </figure>
      <figure>
        <img src="//wiki.selfhtml.org/images/f/fd/Burg-in-N%C3%BCrnberg-3.jpg" alt="Blick auf Kaiserburg am Abend- eigene Aufnahme">
        <figcaption>abends</figcaption>
      </figure>
      <figcaption>Die Bilder zeigen die Kaiserburg in Nürnberg zu verschiedenen Tageszeiten.</figcaption>
    </figure>  

</body>
</html>