likes
comments
collection
share

css实现一个简单的 闪烁效果

作者站长头像
站长
· 阅读数 300

纯css闪烁效果demo

具体速度和颜色自己可以自己调

    <div class="father-box">
        <div class="header-box">
        </div>
    </div>
@keyframes test {
    from {        
    opacity: 1.0;    
    }
    50% {        
    opacity: 0.4;    
    }
    to {        
    opacity: 1.0;    
    }
}
@-webkit-keyframes test {    
    from {        
    opacity: 1.0;    
    }
    50% {        
    opacity: 0.4;    
    }
    to {        
    opacity: 1.0;    
    }
}
.father-box {
    position: relative;
}

.header-box {    
    color: #fff;    
    padding: 10px;    
    font-size: 15px;    
    height: 300px;    
    background-color: rgba(146, 139, 139, .8);
    animation: test 1000ms infinite;    
    -webkit-animation: test 1000ms infinite;
}

效果

css实现一个简单的 闪烁效果css实现一个简单的 闪烁效果