(CSS 实践)使用动画制作闪亮标题

效果图


HTML 代码


<h1 class="title" style="text-align: center;">
    <span>数</span>
    <span>据</span>
    <span>字</span>
    <span>典</span>
    <span>管</span>
    <span>理</span>
</h1>

 CSS 代码


.title span {
    color: #fff;
    animation: animate 3s linear infinite;
}

.title span:nth-child(1) {
    animation-delay: 0s;
}

.title span:nth-child(2) {
    animation-delay: 0.5s;
}

.title span:nth-child(3) {
    animation-delay: 1s;
}

.title span:nth-child(4) {
    animation-delay: 1.5s;
}

.title span:nth-child(5) {
    animation-delay: 2s;
}

.title span:nth-child(6) {
    animation-delay: 2.5s;
}

@keyframes animate{
    0%, 100%{
        color: #fff;
        text-shadow: 0 0 10px #1e90ff,
        0 0 20px #1e90ff,  
        0 0 30px #1e90ff,  
        0 0 40px #1e90ff,        
        0 0 100px #1e90ff,  
        0 0 200px #1e90ff,  
        0 0 300px #1e90ff,  
        0 0 400px #1e90ff;
    }
    5%, 95%{
        color: #000;
        filter: blur(0px);
        text-shadow: none;
    }
}

猜你喜欢

转载自blog.csdn.net/qq_39291919/article/details/108958209