Skip to content

Commit 7f3c3ce

Browse files
committed
Fix layout shift by using max-width and opacity instead of width animation
1 parent f3baf4d commit 7f3c3ce

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

index.html

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,11 @@ <h3>Connect</h3>
9696
.typewriter {
9797
overflow: hidden;
9898
white-space: nowrap;
99-
margin: 0 auto;
10099
letter-spacing: 0.05em;
101-
animation: typing 0.8s steps(30, end) forwards;
102-
width: 0;
100+
opacity: 0;
101+
animation:
102+
typing 0.8s steps(30, end) forwards,
103+
fade-in 0s 0s forwards;
103104
}
104105

105106
.typewriter::after {
@@ -113,10 +114,11 @@ <h3>Connect</h3>
113114
.typewriter-delay-1 {
114115
overflow: hidden;
115116
white-space: nowrap;
116-
margin: 0 auto;
117117
letter-spacing: 0.05em;
118-
width: 0;
119-
animation: typing 0.7s steps(40, end) 0.9s forwards;
118+
opacity: 0;
119+
animation:
120+
typing 0.7s steps(40, end) 0.9s forwards,
121+
fade-in 0s 0.9s forwards;
120122
}
121123

122124
.typewriter-delay-1::after {
@@ -134,8 +136,12 @@ <h3>Connect</h3>
134136
}
135137

136138
@keyframes typing {
137-
from { width: 0; }
138-
to { width: 100%; }
139+
from {
140+
max-width: 0;
141+
}
142+
to {
143+
max-width: 100%;
144+
}
139145
}
140146

141147
@keyframes blink-caret {

0 commit comments

Comments
 (0)