How to create Animated bars using HTML and CSS? Last Updated : 05 Aug, 2020 Comments Improve Suggest changes Like Article Like Report Dancing bars are one of the classical components that are used in making a good looking website. They are very simple to implement and can be used as a loader or an animation while recording sound. Approach: The approach is to use unordered list to create bars and then animate them using keyframes. You should have knowledge of keyframes and n-th child property of CSS before going any further in this article. HTML Code: In this section, we have created an unordered list. html <!DOCTYPE html> <html> <head> <title>Dancing Bars</title> </head> <body> <ul> <li></li> <li></li> <li></li> <li></li> <li></li> <li></li> </ul> </body> </html> CSS Code: For CSS, follow the these steps: Step 1: Align ul to the center of the page.Step 2: Remove all styling of the list and apply some width and height to make bar like shape.Step 3: Use keyframes to animate bars along the Y-axis. Increase the scale on final frame to do so.Step 4: Use n-th child property to apply .1s delay between each li element. Tip: You can also make the same design in horizontal view by using scaleX and keeping the list in their default arrangement. html ul{ position: absolute; top:50%; left:50%; display: flex; } ul li{ list-style: none; width: 6px; height: 20px; background: #262626; margin: 0 4px; animation: animate .7s infinite alternate } @keyframes animate { 0%{ transform: scaleY(1); } 25%{ transform: scaleY(1); } 50%{ transform: scaleY(1); } 75%{ transform: scaleY(1); } 100%{ transform: scaleY(3); } } ul li:nth-child(1){ animation-delay: .1s; } ul li:nth-child(2){ animation-delay: .2s; } ul li:nth-child(3){ animation-delay: .3s; } ul li:nth-child(4){ animation-delay: .4s; } ul li:nth-child(5){ animation-delay: .5s; } ul li:nth-child(6){ animation-delay: .6s; } Complete Code: It is the combination of the above two sections of code. html <!DOCTYPE html> <html> <head> <title>Dancing Bars</title> <style> ul{ position: absolute; top:50%; left:50%; display: flex; } ul li{ list-style: none; width: 6px; height: 20px; background: #262626; margin: 0 4px; animation: animate .7s infinite alternate } @keyframes animate { 0%{ transform: scaleY(1); } 25%{ transform: scaleY(1); } 50%{ transform: scaleY(1); } 75%{ transform: scaleY(1); } 100%{ transform: scaleY(3); } } ul li:nth-child(1){ animation-delay: .1s; } ul li:nth-child(2){ animation-delay: .2s; } ul li:nth-child(3){ animation-delay: .3s; } ul li:nth-child(4){ animation-delay: .4s; } ul li:nth-child(5){ animation-delay: .5s; } ul li:nth-child(6){ animation-delay: .6s; } </style> </head> <body> <ul> <li></li> <li></li> <li></li> <li></li> <li></li> <li></li> </ul> </body> </html> Output: Comment More infoAdvertise with us Next Article How to create Animated bars using HTML and CSS? S sirohimukul1999 Follow Improve Article Tags : Web Technologies Web Templates Similar Reads How to create animated banner links using HTML and CSS? Links are one of the most important parts of any component that is used in website making. Almost every component had some form of links in it. A common example is a menu/nav-bar. All we see is some button like home, about, etc. but under the hood they all are links. Sometimes there comes a situatio 2 min read How to create a progress bar animation using HTML and CSS ? In this mini Web Development project we will utilize CSS animations and create a progress bar using them. The progress bar will start from zero and go to a certain extent as we want. The progress bar is basically showing the expertise of a programmer in different languages in animated form. Prerequi 3 min read How to Create Text Color Animation using HTML and CSS ? The text color can be changed according to the programmerâs choice using CSS @keyframes rule. In this article, we will see how to create text color animation using HTML and CSS. Preview:Approach:Create an HTML file with a centered <div> containing an <h2> element.Use CSS to reset default 1 min read Create an Icon Bar using HTML and CSS This article provides a complete idea of how to create an Icon Bar using HTML and CSS. HTML is used to design the structure, and CSS applies styles to the elements to make the user interface (UI) attractive. To add the Icons, we use the Font Awesome icons CDN link in the head section, and add the ic 2 min read How to create a progress bar using HTML and CSS? The progress bar is an important element in the web, the progress bar can be used for downloading, marks obtained, skill measuring unit, etc. To create a progress bar we can use HTML and CSS. To make that progress bar responsive you will need JavaScript.In this article, we will learn to create progr 1 min read Like