adc

clicks

Sunset animation with pure css | Pure css animation

 


HTML
Before we start writing code first, we need to create a primary structure of the HTML document, so that the browser can understand and start working. The basic HTML structure looks like the following.
After writing the primary structure of the HTML document, you will also write the tags and content you need. After that, you can see the output in your browser. We know that HTML Sudu Mae is used for exposing content in a basic format. To complete our content we need to use CSS, which is an HTML insert and it creates an engaging user interface.


<!DOCTYPE html>
<html>
<head>
               <title>sunset animation pure css</title>
               <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
               <div class="sun"></div>
               <img src="bg.png" width="100%">
               <div class="moon"></div>
</body>
</html>

 CSS 

Now, we have time to improve the HTML content, for that, we need to add CSS to the HTML file. CSS can be added to HTML documents in a total of three ways, here we are using outside CSS design using CSS will arrive here after typing and see the output in your browser.


body{
               background-color: #ccccff;
               margin: 0;
               overflow: hidden;
               animation: sky 5.5s 2s forwards;
}
@keyframes sky{
               50%{
                              background-color: #ffd700;
               }
               65%{
                              background-color: #ffb90f;
               }
               85%{
                              background-color: #b39800;
               }
               100%{
                              background-color: #68228b;
               }
              
}
 img{
               position: absolute;
               bottom: 0px;
}
 .sun{
               height: 100px;
               width: 100px;
               background-color: #ff8c1a;
               border-radius: 50%;
               position: absolute;
               left: 50%;
               box-shadow: 0px 0px 20px 5px #ff8c1a;
               animation: sunset 12s forwards;
}
 @keyframes sunset{
               100%{
                              transform: translateY(750px);
               }
}
 .moon{
               background-color: #68228b;
               width: 100px;
               height: 100px;
               border-radius: 50%;
               box-shadow: -20px 10px white;
               position: absolute;
               left: 10%;
               top: 5%;
               opacity: 0;
               animation: night 0.8s 7s forwards;
}
@keyframes night{
               100%{
                              opacity: 1;
               }
}





Sunset animation with pure css | Pure css animation Sunset animation with pure css | Pure css animation Reviewed by easycoding on August 28, 2020 Rating: 5

No comments:

Powered by Blogger.