• HTML和CSS在文本上液体填充动画效果


    HTML代码

    <!DOCTYPE html> <html lang="en"> <head>     <meta charset="UTF-8" />     <meta name="viewport"        content="width=device-width, initial-scale=1.0" />     <title>用HTML和CSS在文本上如何创建液体填充动画效果?</title> </head> <body>     <center>         <h1>WEB前端开发公众号</h1>     </center> </body> </html> 
    在开始CSS之前,你必须熟悉CSS中的一些概念,其他效果则完全取决于开发者。CSS代码:
    <style>     body {         margin: 0;         padding: 0;     } 
        h1 {         margin: 200px 0;         padding: 0;         font-size: 80px;         position: relative;         color:green;     } 
        h1:before {         content: "WEB前端开发公众号";         position: absolute;         top: 0;         left: 0;         width: 100%;         height: 100%;         color:white;         overflow: hidden;         animation: animate 6s infinite;     } 
        @keyframes animate {         0% {         height: 25%;         }         25% {         height: 50%;         }         50% {         height: 65%;         }         75% {         height: 40%;         }         100% {         height: 25%;         }     } </style> 
    最后,我们将上述两个部分代码内容合并为一体,以实现对文本的液体填充效果。完整代码如下:
    <!DOCTYPE html> <html lang="en"> <head>     <meta charset="UTF-8" />     <meta name="viewport" content=         "width=device-width, initial-scale=1.0" />     <title>        用HTML和CSS在文本上如何创建液体填充动画效果?     </title> 
        <style>         body {             margin: 0;             padding: 0;         } 
            h1 {             margin: 200px 0;             padding: 0;             font-size: 80px;             position: relative;             color:green;         } 
            h1:before {             content: "WEB前端开发公众号";             position: absolute;             top: 0;             left: 0;             width: 100%;             height: 100%;             color:white;             overflow: hidden;             animation: animate 6s infinite;         } 
            @keyframes animate {             0% {             height: 25%;             }             25% {             height: 50%;             }             50% {             height: 65%;             }             75% {             height: 40%;             }             100% {             height: 25%;             }         } </style> </head> 
    <body>     <center>         <h1>WEB前端开发公众号</h1>     </center> </body> 
    </html> 
  • 相关阅读:
    「洛谷 NOIP 计划 2021」【学习1】降维技巧
    组合数取模 合集
    浅谈并查集
    四边形不等式优化 dp (doing)
    qbxt数学五一Day4
    qbxt五一数学Day3
    qbxt五一数学Day2
    qbxt五一数学Day1
    浅谈拉格朗日插值
    10-交换排序:冒泡排序
  • 原文地址:https://www.cnblogs.com/xiewangfei123/p/13564577.html
Copyright © 2020-2023  润新知