css3 fade in on page load, out after seconds

后端 未结 4 1772
不思量自难忘°
不思量自难忘° 2021-02-10 16:55

i have been searching around stackoverflow for an answer for a while but it seems to me this isn\'t been questioned before.

excuses if i might have missed the answer som

4条回答
  •  执笔经年
    2021-02-10 17:36

    You should use only one animation for an element: http://jsfiddle.net/maximgladkov/YR5UM/

    @-webkit-keyframes fade {
        0% {
            opacity: 0;
        }
    
        10% {
            opacity: 1;
        }
    
        90% {
            opacity: 1;
        }
    
        100% {
            opacity: 0;
        }
    }
    
    div {
        width: 400px;
        margin: 0 auto;
        text-align: center;
        -webkit-animation: fade 6s;
        -webkit-animation-fill-mode: both;
    }
    

提交回复
热议问题