CSS animation won't work with 'overflow: hidden;'

前端 未结 2 1718
感情败类
感情败类 2021-01-12 17:30

I would appreciate if someone could point me into the right direction by telling me what I\'m doing wrong. Please look at this example. As you can see I\'m trying to move \'

2条回答
  •  星月不相逢
    2021-01-12 18:07

    Another trick could be moving overflow: hidden to the animated element:

    http://jsfiddle.net/GLdQs/9/

    #id1 {
        width: 0px;
        overflow: hidden;
    }
    
    #id1 > p {
        width: 500px; /* you probably want a fixed width for the content  */
    }
    
    @-webkit-keyframes slide {
      0%   { left: 500px; top: 0px; width:   0px; }
      100% { left:   0px; top: 0px; width: 500px; }
    }
    
    ​
    

提交回复
热议问题