Is it possible to add a transition for a center-aligned text that changes due to an action? (codepen)
HTML :
<div id="container">Lorem ipsum dolor sit amet consectetur adipiscing elit</div>
CSS :
#container {
width: 400px;
height: 20px;
background: #000;
color: white;
text-align: center;
}
(The codepen example demonstrates dynamic data, in my case, the data is changed by React states)
EDIT: Only the last part of the text changes, e.g.
Lorem ipsum dolor sit amet consectetur adipiscing elit
changes to Lorem ipsum dolor ...
. I want to display the shortened text moving to the center from the left (since the remaining text will be on the left side when cut off).