Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does css do horizontal scrolling text

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail how to do horizontal scrolling text in css. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

In css, the keyframes rule, animation, and transform attributes can be used to scroll horizontally, and the syntax is "element {animation: name time} @ keyframes name {100% {transform:translateX (scrolling distance)}}".

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

How to scroll text horizontally with css

In css, if you want to scroll horizontally, you need to use the animation attribute and the @ keyframes rule to achieve the animation of element scaling, and through the @ keyframes rule, you can create animation.

The principle of creating animation is to gradually change one set of CSS styles into another. You can change this CSS style many times during the animation process.

Specify the time when the change occurs as a percentage, or through the keywords "from" and "to", which is equivalent to 0 and 100%. 0% is the start time of the animation and the end time of 100% of the animation. For optimal browser support, you should always define 0% and 100% selectors.

The transform property is also used to set the effect of text scrolling. The transform attribute applies a 2D or 3D transformation to the element. This attribute allows us to rotate, scale, move, or tilt the element.

Examples are as follows:

Document div {width:200px; border:1px solid # 000; overflow:hidden;} p {animation:fadenum 5s infinite;} @ keyframes fadenum {0% {transform:translateX (200px);} 100% {transform:translateX (- 200px);}}

This is a horizontal scrolling text.

Output result:

This is the end of this article on "how css does horizontal scrolling text". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report