这是一款CSS3水波文字动画特效。该特效中通过CSS代码,将字幕制作为类似透明容器的效果,里面有各种颜色的液体在不停的移动,效果非常炫酷。
使用方法
HTML代码
<section class="section"> <div class="container"> <div class="row mt-15"> <div class="text-center widthset"> <div class="position-relative rounded-top progress-wrapper" style=" background-image: linear-gradient(to bottom, #f8e739, #f1d42d, #eac222, #e1b019, #d89e10);"> <div class="wave" style="bottom: 80%;"> <h1 class="heading-style">L</h1> </div> </div> </div> <div class="text-center widthset"> <div class="position-relative rounded-top progress-wrapper" style="background-image: linear-gradient(to bottom, #d89e10, #e28f00, #ec7f00, #f66b00, #ff5200);"> <div class="wave" style="bottom: 80%;"> <h1 class="heading-style">I</h1> </div> </div> </div> <div class="text-center widthset"> <div class="position-relative rounded-top progress-wrapper" style="background-image: linear-gradient(to bottom, #e2130b, #e1110c, #e00f0d, #df0c0d, #de090e);"> <div class="wave" style="bottom: 80%;"> <h1 class="heading-style">Q</h1> </div> </div> </div> <div class="text-center widthset"> <div class="position-relative rounded-top progress-wrapper" style="background-image: linear-gradient(to bottom, #ce0061, #d50079, #d60094, #d000b3, #c115d4);"> <div class="wave" style="bottom: 80%;"> <h1 class="heading-style">U</h1> </div> </div> </div> <div class="text-center widthset"> <div class="position-relative rounded-top progress-wrapper" style="background-image: linear-gradient(to bottom, #6a0ddc, #5f0ddd, #530edd, #450fde, #3210de);"> <div class="wave" style="bottom: 80%;"> <h1 class="heading-style">I</h1> </div> </div> </div> <div class="text-center widthset"> <div class="position-relative rounded-top progress-wrapper" style="background-image: linear-gradient(to bottom, #0c2fd4, #0045d8, #0056d9, #0065d8, #1b73d5);"> <div class="wave" style="bottom: 80%;"> <h1 class="heading-style">D</h1> </div> </div> </div> </div> </div> </section>
CSS代码
.container { max-width: 960px; } body { background-color: #fafafa; } .widthset { width: 16.5%; } .heading-style { font-family: 'Righteous', cursive; font-size: 205px; font-weight: bolder; -webkit-text-stroke: 2px rgba(6, 188, 209, 0.2); background: #ffffff; mix-blend-mode: screen; padding-top: 190px; } @media (min-width: 1200px) .container, .container-lg, .container-md, .container-sm, .container-xl { max-width: 1140px; } @media (min-width: 992px) .container, .container-lg, .container-md, .container-sm { max-width: 960px; } @media (min-width: 768px) .container, .container-md, .container-sm { max-width: 720px; } @media (min-width: 576px) .container, .container-sm { max-width: 540px; } @media (min-width: 1200px) .container { max-width: 1140px; } @media (min-width: 992px) .container { max-width: 960px; } @media (min-width: 768px) .container { max-width: 720px; } @media (min-width: 576px) .container { max-width: 540px; } .shadow { box-shadow: 0px 18px 39.1px 6.9px rgba(224, 241, 255, 0.34) !important; } .card { border: 0; } .mt-15 { margin-top: 15%; } .progress-wrapper { height: 240px; overflow: hidden; } .wave { position: absolute; width: 100%; height: 100%; } .card-body { -ms-flex: 1 1 auto; flex: 1 1 auto; min-height: 1px; padding: 1.25rem; } .card-title { margin-bottom: .75rem; } .list-unstyled { padding-left: 0; list-style: none; } .card { position: relative; display: -ms-flexbox; display: flex; -ms-flex-direction: column; flex-direction: column; min-width: 0; word-wrap: break-word; background-color: #fff; background-clip: border-box; border: 1px solid rgba(0, 0, 0, .125); border-radius: .25rem; margin-bottom: 20px; } .wave::before, .wave::after { content: ""; position: absolute; width: 470px; height: 390px; bottom: 0; left: 55%; background-color: rgba(255, 255, 255, 0.18); border-radius: 70%; -webkit-transform: translateX(-50%) rotate(0); transform: translateX(-50%) rotate(0); -webkit-animation: rotate 6s linear infinite; animation: rotate 6s linear infinite; z-index: 10; } .wave::after { border-radius: 30%; background-color: rgba(255, 255, 255, 0.9); -webkit-transform: translateX(-50%) rotate(0); transform: translateX(-50%) rotate(0); -webkit-animation: rotate 10s linear -5s infinite; animation: rotate 10s linear -5s infinite; z-index: 20; } @keyframes rotate { 50% { transform: translateX(-50%) rotate(180deg); } 100% { transform: translateX(-50%) rotate(360deg); } } @media only screen and (max-width: 768px) { .heading-style { font-family: 'Righteous', cursive; font-size: 156px; } .progress-wrapper { height: 209px; } } @media only screen and (max-width: 425px) { .heading-style { font-family: 'Righteous', cursive; font-size: 65px; } .progress-wrapper { height: 148px; } .wave::before, .wave::after { width: 490px; height: 331px; } }