Hello friends, today we will be going to create preloader using HTML and CSS . I have posted many videos and articles before related to the JavaScript project, now this the something new that we are going to build.
Video Tutorial of How to create preloader using HTML and CSS
As you have seen on the given video tutorial of Speech Text Reader Using Html, CSS and JavaScrip,
If you are feeling bored watching the given video tutorial of create preloader using HTML and CSS then you can copy or download the given codes below:
create preloader using HTML and CSS | Free Source Code
To create this program (Speech Text Reader). First, you need to create two Files one HTML File and another one is CSS File. After creating these files just paste the following codes in your file.
In the first place, make a HTML document with the name of index.html and glue the given codes in your HTML record. Keep in mind, you've to make a document with .html extension.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>How to create preloader</title>
<link rel="stylesheet" href="./style.css">
<!-- www.youtube.com/STech04 -->
</head>
<body>
<div class="circle" data-dots="25"></div>
<script src="./script.js"></script>
</body>
</html>
Second, make a CSS record with the name of style.css and glue the given codes in your CSS document. Keep in mind, you've to make a record with .css extension.
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: sans-serif;
}
body{
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: #333;
}
.circle
{
width: 100px;
height: 100px;
position: relative;
display: flex;
justify-content: center;
align-items: center;
}
.circle .point
{
width: 9px;
height: 9px;
background: #fff;
border-radius: 50%;
position: absolute;
transform: rotate(calc(var(--i)*var(--rot))) translate(-50px) scale(0);
animation: animate 0.7s linear infinite;
animation-delay: calc(var(--i)*0.03s);
}
@keyframes animate
{
0%,100%
{
transform: rotate(calc(var(--i)*var(--rot))) translate(-50px) scale(0);
}
50%
{
transform: rotate(calc(var(--i)*var(--rot))) translate(-50px) scale(1);
}
}
Last, create a JavaScript file with the name of script.js and paste the given codes in your JavaScript file. Remember, you’ve to create a file with .js extension.
const circle = document.querySelector(".circle");
let dots = circle.getAttribute("data-dots");
let rotate = 360 / dots;
points = "";
for (let i = 0; i < dots; i++) {
points+=`<span> class="point" style="--i: ${i}; --rot: ${rotate}deg;"></span>`
}
circle.innerHTML = points;
That’s all, now you’ve successfully created a program Speech Text Reader Using Html, CSS and JavaScrip. If your code doesn’t work or you’ve faced any error/problem, please download the source code files from the given download button. It’s free and a .zip file will be downloaded then you’ve to extract it.
Click on the following download button to download all source code files.
Post a Comment
How can I help you