Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize the scrolling effect of text cycle in css

Shulou Source: shulou.com Published: 2022-06-02 16:46:41 10月27日 Update

This article mainly introduces "how to achieve text cycle scrolling effect in css". In daily operation, I believe many people have doubts about how to achieve text cycle scrolling effect in css. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "how to achieve text cycle scrolling effect in css". Next, please follow the editor to study!

Css to achieve text cycle scrolling methods: 1, in the text elements using the animation attribute to bind a circular animation; 2, the use of "@ keyframes" rule and "transform: translateX" statement to set the animation of each frame of the translation position of Chinese characters.

The operating environment of this tutorial: windows7 system, CSS3&&HTML5 version, Dell G3 computer.

Realizing the scrolling effect of text cycle with css

In css, you can use animationh and keyframest to achieve the text loop scrolling effect by binding a circular scrolling animation to the text.

Implementation code:

Html:

The content of scrolling text

Css:

.box {width: 100%; margin: 0 auto; border: 1px solid # ff6700; overflow: hidden;}. Animate {padding-left: 20px; font-size: 12px; color: # 000; display: inline-block; white-space: nowrap; animation: 5s wordsLoop linear infinite normal;} @ keyframes wordsLoop {0% {transform: translateX;-webkit-transform: translateX } 100% {transform: translateX;-webkit-transform: translateX;}} @-webkit-keyframes wordsLoop {0% {transform: translateX;-webkit-transform: translateX;} 100% {transform: translateX;-webkit-transform: translateX;}}

Effect picture:

Description:

The Transform attribute is applied to the 2D or 3D transformation of an element. This property allows you to rotate, scale, move, tilt, and so on.

TranslateX (x): defines the translation transformation, using only the value of the X axis.

At this point, the study on "how to achieve the text cycle scrolling effect in css" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Tags: Text loops effects content learning elements animation attributes methods more help translation utility next code location just renderings tutorials articles Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology MySQL Docker Linux Shulou Information