This question is similar to this question resolved previously: CSS text-align delay with width animation
I have an animation that goes from 0% width to 100% with the intent of loading the page without any text visible and immediately revealing it from left to right.
I noticed that with the padding included, the first portion of the text on the left loads already visible. What is the reason for this? Thanks!
@keyframes leftright {
0% {
max-width: 0%;
}
100% {
max-width: 100%;
}
}
.test_1 {
overflow: hidden;
white-space: nowrap;
width: 80vw;
padding: 0 10vw;
border: 1px solid red;
font: bold 15vmin 'Playfair Display', serif;
animation: leftright 1s;
}
<div class="test_1">Why hello there</div>