Animated Background with Pure CSS and Html

Today in this blog, I will share a snippet on creating an animated background with pure CSS and HTML. No JavaScript or jQuery was used in this project while creating the snippet. 

CSS animation is often used to animate elements like width, height, color, etc. it helps create an excellent website design that grabs visitors' attention. We can design lots of magnificent animation with the css3. This project is one of the examples of that. This project makes a simple-looking homepage with a navbar and a background animation where some boxes will appear from the bottom. These boxes will go up with rotating animation, and at one stage, they will disappear.

Let's starts with the HTML markup. The HTML markup is straightforward. First, I have taken a div named 'banner-text' and placed an unordered list of five nav items. I have taken an h2 tag with some random text and as a banner text. Later I have taken another div named 'animation-area' where I placed another unordered list called 'box-area.' inside, I have taken six li elements, which I will use to make the box animation. To understand better, I will recommend you to follow the video tutorial below.

I hope you watched the entire video. Now, let's start with the CSS. First, I omitted the default margin padding by providing the universal selector a margin and zero paddings. I have used Baloo google free font for this project. You can use yours from the google fonts. Then I have styled the navbar with basic CSS styling make it over to the top-right corner of the project. Then I have given the 'animation-area' div a nice gradient-color and width and height, which occupied the entire viewport height and width of the webpage. Later styled to h2 banner text to make the center of the webpage. 

Now comes to the styling of box animation. First, I gave 'box-area' ul an absolute position value. Later, it gave it a width and height of 100% and an 'overflow: hidden' value so that project does not overflow the project's viewport. Then I have given the li element width and height of 25px. After that, I set an animation named 'animate' with an animation duration-duration of the 20s. I have given each li element a separate left, width, height, and animation-delay value. I then set CSS keyframes animation for the animate class with transform translate and rotate value.

Animated Background with Pure CSS and HTML (Source code):

first, create an HTML and CSS file. Later link the CSS file to your HTML file. Copy the files below and paste them into the individual files.



I hope you like this simple and yet exciting project. Please subscribe to my youtube channel and follow my social media profiles to stay connected with this blog. Thank you for visiting, and keep coming for more interesting snippets. 

Post a Comment

Please Do not Enter any spam link in the comment box