【第12期】css加载文本动画效果

2023-03-20

html代码如下:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>css加载文本动画效果</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1 data-text="Loading...">
Loading...
</h1>
</body>
</html>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>css加载文本动画效果</title> <link rel="stylesheet" href="style.css"> </head> <body> <h1 data-text="Loading..."> Loading... </h1> </body> </html>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>css加载文本动画效果</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <h1 data-text="Loading...">
        Loading...
    </h1>
</body>
</html>

css代码如下:

body{
margin:0;
padding: 0;
box-sizing: border-box;
background-color: #000;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
}
h1{
position:relative;
color:#333;
font-size: 4em;
letter-spacing: 5px;
border-bottom: 16px solid #333;
line-height: 1.4;
font-family: consolas;
text-transform: uppercase;
}
h1::before{
content: attr(data-text );
position: absolute;
top: 0;
left:0;
width:100%;
color:dodgerblue;
border-bottom: 16px solid dodgerblue;
animation:lod 2s linear infinite;
overflow: hidden;
}
@keyframes lod{
0%{
width:0;
}
100%{
width:100%;
}
}
body{ margin:0; padding: 0; box-sizing: border-box; background-color: #000; overflow: hidden; display: flex; align-items: center; justify-content: center; height: 100vh; } h1{ position:relative; color:#333; font-size: 4em; letter-spacing: 5px; border-bottom: 16px solid #333; line-height: 1.4; font-family: consolas; text-transform: uppercase; } h1::before{ content: attr(data-text ); position: absolute; top: 0; left:0; width:100%; color:dodgerblue; border-bottom: 16px solid dodgerblue; animation:lod 2s linear infinite; overflow: hidden; } @keyframes lod{ 0%{ width:0; } 100%{ width:100%; } }
body{
    margin:0;
    padding: 0;
    box-sizing: border-box;
    background-color: #000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
}
h1{
    position:relative;
    color:#333;
    font-size: 4em;
    letter-spacing: 5px;
    border-bottom: 16px solid #333;
    line-height: 1.4;
    font-family: consolas;
    text-transform: uppercase;
}
h1::before{
    content: attr(data-text  );
    position: absolute;
    top: 0;
    left:0;
    width:100%;
    color:dodgerblue;
    border-bottom: 16px solid dodgerblue;
    animation:lod 2s linear infinite;
    overflow: hidden;
}
@keyframes lod{
    0%{
        width:0;
    }
    100%{
        width:100%;
    }
}
相关内容
最新

坚持的力量

wordpress建站,视频剪辑拍摄,动画制作