<!-- 立体文字阴影效果 -->
<!-- flex布局居中 -->
<!-- 伪元素位移、形变、遮罩、滤镜实现阴影 -->
<!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>Shadow</title>
</head>
<body>
<div id="container">
<h1>Shadow</h1>
</div>
</body>
<style>
*{
margin: 0;
padding: 0;
}
body{
background-color:#ccc;
}
#container{
display: flex;
justify-content: center; /*居中*/
align-items: center; /*居中*/
height: 100vh; /*视窗*/
}
h1{
margin: 0 auto;
font-size: 200px;
font-weight: 800;
color: rgb(255, 255, 255);
}
h1::before{
content: 'Shadow';
position: absolute;
color: rgb(37,37,37);
transform: translate(-47px,39px) skew(50deg) scaleY(0.5); /*位置变化、倾斜效果、Y轴缩放*/
z-index: -1; /*处理层级*/
filter: blur(5px); /*毛边*/
-webkit-mask-image: linear-gradient(transparent,#000); /*遮罩层设置渐变色*/
}
</style>
</html>
效果实例: