adc

clicks

CSS Background Animation effects | Background Animation effects with html and css

 It`s already known by designers and developers that backgrounds are one of the most important aspects in the overall design and feel of a web page. Recently people have been turning to animation to add more visual interest to their website background. These animated backgrounds are great when used as a site introduction, functional hover navigation elements, and other creative ways to attract interest and draw users in.

 

 

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>Animation backgroujnd </title>

               <link rel="stylesheet" type="text/css" href="style.css">

</head>

<body>

               <div class="container">

                              <h1>Hello Programmer</h1>

                              <div class="bg"></div>

</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.

*{

               margin: 0;

               padding: 0;

}

.container{

               width: 100%;

               height: 500px;

               background:linear-gradient(to bottom right,purple,skyblue);

               position: relative;

               text-align: center;

}

.bg{

               width: 100%;

               height: 100px;

               background-image: url(bg.png);

               position: absolute;

               bottom: 0;

               left: 0;

               animation: bg 5s linear infinite;

}

h1{

               font-size: 100px;

               font-family: sans-serif;

               color: white;

               line-height: 450px;

}

@keyframes bg{

               0%{

                              background-position-x:1000px;

                              bottom: 0;

               }

               100%{

                              background-position-x:0;

                              bottom: 0;

               }

}

 

 

Source Code
 

                                                    Watch Full Video

 

CSS Background Animation effects | Background Animation effects with html and css  CSS Background Animation effects |  Background Animation effects with html and css Reviewed by easycoding on August 24, 2020 Rating: 5

No comments:

Powered by Blogger.