I have a <div>
, to display the text. And given animation for the <div>
.
I want to animate the <div>
when change the text. How do I change the css
HTML
<div id="location-name-container">
<div id="location-name"></div>
</div>
document.getElementById('location-name').innerHTML = "Hello"
CSS
#location-name {
align-self: center;
width: 540px;
max-height: 100px;
color: #FFFFFF;
-webkit-text-stroke-color: #000000;
font-size: 42px;
line-height: 50px;
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
animation: fade-in 200ms;
}
@keyframes fade-in {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes fade-out {
from { opacity: 1; }
to { opacity: 0; }
}