Hello wizards, I hope you are doing great. Today in this blog you’ll learn how to create the Loader using HTML & CSS (part-2).
Preview
In the above video, you’ve seen the preview of the Loader and I hope you are now able to create this type of project. If not, I have provided all the HTML & CSS code below.
Loader [Source Code]
To get the following HTML & CSS code for the Loader. You need to create two files one is an HTML file, and the second one is a CSS file. After completing these two files, you can copy-paste the codes on your document.
Remember, you’ve to create a file with a .html extension for HTML code and a .css extension for CSS code.
You can also download all source code files from the given download button.
HTML
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Loader</title> <link rel="stylesheet" href="./style.css"> </head> <body> <div class="loader">Loading...</div> </body> </html>
CSS
body {
margin: 0;
padding: 0;
background: white;
font-family: sans-serif;
}
.loader {
width: 250px;
height: 50px;
color: blueviolet;
line-height: 50px;
font-weight: 700;
text-align: center;
letter-spacing: 4px;
text-transform: uppercase;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.loader::before,
.loader::after {
content: "";
width: 15px;
height: 15px;
background: blueviolet;
position: absolute;
animation: loading 0.8s infinite alternate ease-in-out;
}
.loader::before {
top: 0;
}
.loader::after {
bottom: 0;
}
@keyframes loading {
0% {
left: 0;
height: 30px;
width: 15px;
}
50% {
height: 8px;
width: 40px;
}
100% {
left: 235px;
height: 30px;
width: 15px;
}
}
Generating Download Link...
