Fade out after div content has been shown using CSS

前端 未结 3 617
有刺的猬
有刺的猬 2021-01-18 02:50

I\'m trying to show a notification on button click. The button click actually checks for email validation. I know to show a div with content with the error message. However,

3条回答
  •  长发绾君心
    2021-01-18 03:34

    You can use animation example.

    Set the animation-delay to the time you want. Make sure you use animation-fill-mode: forwards to stop the animation.

    #signup-response{
        width: 50%;
        margin-left: auto;
        margin-right: auto;
        text-align: center;
        background-color: #FF0000;
        margin-top: 20px;
    
         animation:signup-response 0.5s 1;
        -webkit-animation:signup-response 0.5s 1;
        animation-fill-mode: forwards;
    
        animation-delay:2s;
        -webkit-animation-delay:1s; /* Safari and Chrome */
        -webkit-animation-fill-mode: forwards;
    
    } 
    
    @keyframes signup-response{
        from {opacity :1;}
        to {opacity :0;}
    }
    
    @-webkit-keyframes signup-response{
        from {opacity :1;}
        to {opacity :0;}
    }
    

提交回复
热议问题