Skip to content

Commit 22512d8

Browse files
✨ [css] Add typewriter animation
1 parent 2622a35 commit 22512d8

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: Typewriter Animation
3+
description: Adds a typewriter animation + blinking cursor
4+
author: AlsoKnownAs-Ax
5+
tags: css,animation
6+
---
7+
8+
```html
9+
<div class="typewriter">
10+
<div>
11+
<p>Typerwriter Animation</p>
12+
</div>
13+
</div>
14+
```
15+
16+
```css
17+
.typewriter{
18+
display: flex;
19+
justify-content: center;
20+
}
21+
22+
.typewriter p {
23+
overflow: hidden;
24+
font-size: 1.5rem;
25+
font-family: monospace;
26+
border-right: 1px solid;
27+
margin-inline: auto;
28+
white-space: nowrap;
29+
/* Steps: number of chars (better to set directly in js)*/
30+
animation: typing 3s steps(21) forwards,
31+
blink 1s step-end infinite;
32+
}
33+
34+
@keyframes typing{
35+
from{
36+
width: 0%
37+
}
38+
f
39+
40+
to{
41+
width: 100%
42+
}
43+
}
44+
45+
@keyframes blink{
46+
50%{
47+
border-color: transparent;
48+
}
49+
}
50+
```

0 commit comments

Comments
 (0)