栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

如何创建字幕效果?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

如何创建字幕效果?

只需稍加更改标记,这就是我的方法(我刚刚

span
在段落中插入了一个内部):

.marquee {  width: 450px;  margin: 0 auto;  white-space: nowrap;  overflow: hidden;  box-sizing: border-box;}.marquee span {  display: inline-block;  padding-left: 100%;  will-change: transform;    animation: marquee 15s linear infinite;}.marquee span:hover {  animation-play-state: paused}@keyframes marquee {  0% {    transform: translate(0, 0);  }  100% {    transform: translate(-100%, 0);  }}@media (prefers-reduced-motion: reduce) {  .marquee {    white-space: normal  }  .marquee span {    animation: none;    padding-left: 0;  }}<p >   <span>       Windows 8 and Windows RT are focused on your life—your friends       and family, your apps, and your stuff. With new things like the       Start screen, charms and a Microsoft account, you can spend       less time searching and more time doing.   </span>   </p>

没有插入硬编码的值(取决于段落宽度)。

该动画应用了CSS3

transform
属性(在需要时使用前缀),因此效果良好。

如果您只需要在开始时插入一次延迟,则还可以设置一个

animation-delay
。如果您需要在 每个
循环中插入一个小的延迟,则尝试使用较高的延迟
padding-left
(例如
150%



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/614946.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号