CSS Animate text from left to right in div container with overflow hidden

前端 未结 4 1133
我寻月下人不归
我寻月下人不归 2021-02-06 00:45

So i\'ve recently working on some private project, and since i am a huge CSS fan i want to do most of the animations in CSS rather than in JavaScript.

Today i wanted to

4条回答
  •  甜味超标
    2021-02-06 01:15

    change your keyframe value in %

    Try This

    body{ 
        overflow: hidden;
    }
    p{
        position: absolute;
        white-space: nowrap;
        animation: floatText 5s infinite alternate ease-in-out;
    }
    
    @-webkit-keyframes floatText{
      from {
        left: 00%;
      }
    
      to {
        /* left: auto; */
        left: 100%;
      }
    }

    hello text

提交回复
热议问题