I've been attempting to add an animation effect to my text so that it appears from left to right when the page loads. To achieve this, I have set up @keyframes
to transition the text from 0% max-width
to 100%.
However, I'm facing an issue where my text-align settings seem to take effect only after the animation has completed. All I want is for the text content itself to reveal itself in the intended position without delay, and I believe my code is correct.
Could there be something obvious that I am overlooking here? While I am relatively new to working with CSS
, my research hasn't pointed out any inherent properties of animations or text-align that could be causing this behavior. I have included a snippet of my code below for reference. Thank you!
@keyframes leftright {
0% {
max-width: 0%;
}
100% {
max-width: 100%;
}
}
.test_1 {
overflow: hidden;
white-space: nowrap;
width: 80vw;
border: 1px solid red;
font: bold 15vmin 'Playfair Display', serif;
text-align: center;
animation: leftright 1s;
}
<div class="test_1">Why hello there</div>