css 跑马灯

 

html:

<view class="in_scro">
  <view class="in_scrview">恭喜139******1用户约看特价房</view>
  <view class="in_scrview">恭喜139******1用户约看特价房</view>
  <view class="in_scrview">恭喜139******1用户约看特价房</view>
  <view class="in_scrview">恭喜139******1用户约看特价房</view>
  <view class="in_scrview">恭喜139******1用户约看特价房</view>
  <view class="in_scrview">恭喜139******1用户约看特价房</view>
</view>

css:

    /* 跑马灯 */
    .in_scro {
        height: 150px;
        width: 80%;
        margin: 15px auto;
        overflow: hidden;
    }

    .in_scrview {
        color: #000000;
        font-size: 15px;
        height: 30px;
        line-height: 30px;
        text-align: center;
        animation: myMove 2s linear infinite;
        animation-fill-mode: forwards;
    }

    /*     .in_scrview:nth-child(even) {
        color: #686767;
        font-size: 16px;
    } */

    /*文字无缝滚动*/
    @keyframes myMove {
        0% {
            transform: translateY(0);
        }

        50% {
            transform: translateY(-30px);
        }

        100% {
            transform: translateY(-60px);
        }
    }

 

posted @ 2020-09-10 12:17  奔跑的前端猿  阅读(2265)  评论(0编辑  收藏  举报