In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to use css3 to achieve on-screen comment effect, the article is very detailed, has a certain reference value, interested friends must read it!
How to realize on-screen comment through css3
First, let's take a look at how to implement the simplest on-screen comment through css's method:
First, define the dom structure of a barrage in html:
I'm the barrage.
The movement of the barrage can be realized by moving the block. Take the barrage moving from right to left as an example. The initial position of the barrage is on the left side of the container and is hidden (the leftmost part of the barrage fits the rightmost part of the container). It can be realized by absolute positioning and transform:
.block {position:absolute;}
Initial position:
From {left:100%; transform:translateX (0)}
Move to the leftmost end position (the rightmost part of the barrage fits the leftmost part of the container):
To {left:0; transform:translateX (- 100%)}
You can define two complete on-screen animations based on the start and end positions:
@ keyframes barrage {from {left:100%; transform:translateX;} to {left:0; transform:translateX (- 100%);}}
Introduce this animation to the on-screen comment element:
.block {position:absolute; / * other decorate style * / animation:barrage 5s linear 0s;}
In this way, a beggar version of the bullet screen effect can be achieved.
The above is all the contents of the article "how to use css3 to achieve on-screen comment effect". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.