How to Create Typewriter Animation with CSS
A teletypewriter effect can be created in CSS by working a font for the text, and animating width CSS property of the text in a fixed number of steps (so that each personality grows out in a single step).
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>typeing text effect</title>
</head>
<body>
<P class="line">Typeing Writer Effect Using css ()</P>
</body>
</html>
<html>
<head>
<title>typeing text effect</title>
</head>
<body>
<P class="line">Typeing Writer Effect Using css ()</P>
</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.
html{
min-height: 100%;
overflow: hidden;
}
body{
padding: 4em;
height: eale(100vh-8em);
font-family: serif;
color: red;
background-color: #191919;
}
.line{
position: absolute;
top: 50%;
left: 20%;
width: 16em;
margin:auto;
font-size: 60px;
text-align: center;
white-space: nowrap;
overflow: hidden;
transform: translateY(-50%);
border-right: 2px solid rgba(255,255,255,0.75);
animation:typewriter 4s steps(40) 1s 1 normal both,
blinkTextCursor 500ms steps(40) infinite normal;
}
@keyframes typewriter{
from{
width: 0;
}
to{
width: 16em;
}
min-height: 100%;
overflow: hidden;
}
body{
padding: 4em;
height: eale(100vh-8em);
font-family: serif;
color: red;
background-color: #191919;
}
.line{
position: absolute;
top: 50%;
left: 20%;
width: 16em;
margin:auto;
font-size: 60px;
text-align: center;
white-space: nowrap;
overflow: hidden;
transform: translateY(-50%);
border-right: 2px solid rgba(255,255,255,0.75);
animation:typewriter 4s steps(40) 1s 1 normal both,
blinkTextCursor 500ms steps(40) infinite normal;
}
@keyframes typewriter{
from{
width: 0;
}
to{
width: 16em;
}
How to Create Typewriter Animation with CSS
Reviewed by easycoding
on
August 06, 2020
Rating:
No comments: