Beispiel:Bildwechsler-4.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" type="text/css" media="screen" href="./Beispiel:SELFHTML-Beispiel-Grundlayout.css" />
  <title>Bildwechsler mit CSS-animation 4</title>
  <style>
main {
  background: transparent;
  border-color: transparent;
}
  
#buehne {
  width: 600px;
  height: 265px;
  position: relative;
  top: 0;
  left: 0;
  overflow: hidden;
  background: none; 
  border: none; 
}
 
#buehne figure {
  width: 600px;
  height: 265px;
  position: absolute;
  margin: 0;
  top: 0;
  left: 0;

}

#buehne figcaption {
  
  position: absolute;
  left: 1em;
  font-size: 2em;
  font-weight: bold;
  bottom: 0.5em;
  color: white;
}

#bilder {
  width: 1800px;
  height: 265px;
  position: absolute;
  top: 0;
  left: 0;
  animation: bilder 15s infinite;
}

#bilder img {
   float: left;
}

@-webkit-keyframes bilder {
    
   0% {left: 0px;}
  35% {left: 0px;}
  36% {left: -600px;}
  70% {left: -600px;}
  71% {left: -1200px;}
 100% {left: -1200px;}
}

@keyframes bilder {
    
   0% {left: 0px;}
  35% {left: 0px;}
  36% {left: -600px;}
  70% {left: -600px;}
  71% {left: -1200px;}
 100% {left: -1200px;}
}
      
@-webkit-keyframes wechseln {
    0% {opacity: 1; transform: scale(1,1);}
   20% {opacity: 1; transform: scale(1,1);}
   34% {opacity: 0; transform: scale(0,0);}
  100% {opacity: 1; transform: scale(0,0);}
}

@keyframes wechseln {
    0% {opacity: 1; transform: scale(1,1);}
   20% {opacity: 1; transform: scale(1,1);}
   34% {opacity: 0; transform: scale(0,0);}
  100% {opacity: 1; transform: scale(0,0);}
}


#buehne figure:nth-of-type(1) {  
  -webkit-animation: wechseln 15s 10s infinite;
  animation: wechseln 15s 10s infinite;
}

#buehne figure:nth-of-type(2) {  
  -webkit-animation: wechseln 15s 5s infinite;
  animation: wechseln 15s 5s infinite;
}

#buehne figure:nth-of-type(3) {  
  -webkit-animation: wechseln 15s infinite;
  animation: wechseln 15s infinite;
}
  </style>
</head>
<body>
  <h1>Bildwechsler mit CSS-animation 4</h1>
  <main>
    <h2>Ein Tag in Nürnberg</h2>  
    <div id="buehne">
     
     <div id="bilder">

       <img src="http://wiki.selfhtml.org/images/f/fd/Burg-in-N%C3%BCrnberg-2.jpg" alt="Blick auf Kaiserburg - eigene Aufnahme">

       <img src="http://wiki.selfhtml.org/images/f/fd/Burg-in-N%C3%BCrnberg-3.jpg" alt="Blick auf Kaiserburg - eigene Aufnahme">

       <img src="http://wiki.selfhtml.org/images/f/fd/Burg-in-N%C3%BCrnberg-1.jpg" alt="Blick auf Kaiserburg - eigene Aufnahme">

    </div>    

     <figure>
       <img src="http://wiki.selfhtml.org/images/f/fd/Burg-in-N%C3%BCrnberg-3.jpg" alt="Blick auf Kaiserburg - eigene Aufnahme">
       <figcaption>abends</figcaption>
     </figure>
     <figure>
       <img src="http://wiki.selfhtml.org/images/b/b9/Burg-in-N%C3%BCrnberg-2.jpg" alt="Blick auf Kaiserburg - eigene Aufnahme">
       <figcaption>mittags</figcaption>
     </figure>
     <figure>
       <img src="http://wiki.selfhtml.org/images/5/58/Burg-in-N%C3%BCrnberg-1.jpg" alt="Blick auf Kaiserburg - eigene Aufnahme">
       <figcaption>morgens</figcaption>
     </figure>
    </div>   
   
  </main>
 
</body>
</html>