Heim  >  Artikel  >  Web-Frontend  >  Animationseffekt mit CSS einblenden

Animationseffekt mit CSS einblenden

王林
王林nach vorne
2023-08-26 08:17:091465Durchsuche

使用 CSS 淡入动画效果

Um mithilfe von CSS einen Einblend-Animationseffekt auf einem Bild zu erzielen, können Sie versuchen, den folgenden Code auszuführen:

Beispiel

Live-Demo

<html>
   <head>
      <style>

         .animated {
            background-image: url(/css/images/logo.png);
            background-repeat: no-repeat;
            background-position: left top;
            padding-top:95px;
            margin-bottom:60px;
            -webkit-animation-duration: 10s;
            animation-duration: 10s;
            -webkit-animation-fill-mode: both;
            animation-fill-mode: both;
         }

         @-webkit-keyframes fadeIn {
            0% {opacity: 0;}
            100% {opacity: 1;}
         }

         @keyframes fadeIn {
            0% {opacity: 0;}
            100% {opacity: 1;}
         }

         .fadeIn {
            -webkit-animation-name: fadeIn;
            animation-name: fadeIn;
         }
      </style>
   </head>
   <body>

      <div id="animated-example" class="animated fadeIn"></div>
      <button onclick="myFunction()">Reload page</button>

      <script>
         function myFunction() {
            location.reload();
         }
      </script>
   </body>
</html>

Das obige ist der detaillierte Inhalt vonAnimationseffekt mit CSS einblenden. Für weitere Informationen folgen Sie bitte anderen verwandten Artikeln auf der PHP chinesischen Website!

Stellungnahme:
Dieser Artikel ist reproduziert unter:tutorialspoint.com. Bei Verstößen wenden Sie sich bitte an admin@php.cn löschen