The simplest solution is to use the <marquee> . The disadvantage of this solution is that the item is outdated and not recommended for use. Therefore, it is likely that in future versions of browsers it will not be supported.
<marquee>This text will scroll from right to left</marquee>
In addition, it is possible to solve using css-animation and, for example, the text-indent properties, or the position of the inner element:
Example:
.marquee { overflow: hidden; height: 1em; animation: 20s linear infinite marquee; } @keyframes marquee { 0% { text-indent: 100%; } 100% { text-indent: -50%; } } .marquee-position { overflow: hidden; height: 1em; position: relative; } .marquee-position > span { position: absolute; animation: 15s linear infinite marquee-position; } @keyframes marquee-position { 0% { left: 100%; } 100% { left: -50%; } }
<div class="marquee">This text will scroll from right to left</div> <div class="marquee-position"><span>This text will scroll from right to left</span> </div>