纯CSS实现文字滚动效果
2018/12/21 14:21:25 | 阅5971 | 来源:好空间网络 [打印] [关闭] |
.topname{ width:750rpx; height:70rpx; background-color: #b5a17c; text-align: center; line-height: 65rpx; } .animate { color: #ffffff; font-size: 35rpx; padding-left: 40rpx; display: inline-block; white-space: nowrap; animation: 20s wordsLoop linear infinite normal; } @keyframes wordsLoop { 0% { transform: translateX(750rpx); -webkit-transform: translateX(750rpx); } 100% { transform: translateX(-100%); -webkit-transform: translateX(-100%); } }
HTML代码:
<view class="topname"> <view class="animate">这里是要滚动的文字可以长一点</view> </view>