css solution to hide div after x amount of seconds

后端 未结 3 1975
伪装坚强ぢ
伪装坚强ぢ 2021-01-04 09:49

Any way using css3 only to remove/hide the #a after say 90 seconds of page load ?


      
      
3条回答
  •  情深已故
    2021-01-04 10:44

    Closest you can come with css only is this..it might be improved further but this as it's..

    http://jsfiddle.net/techsin/7g7ofazj/

    .red {
        background-color: red; width: 100px; height: 100px;
        -webkit-animation: ani 1s forwards;
    }
    
    @-webkit-keyframes ani {
        89%  {opacity:1;height: 100px;}
        90%  {opacity:0; height: 0;}
        100%  {opacity:0; height: 0;}
    }
    

    And if you wanted to do with javascript/jquery..

    you would do this..

    var ele = $(".hide_after_90_seconds");
    setTimeout(function() { ele.hide(); }, 9000);
    

提交回复
热议问题