本文最后更新于835 天前,其中的信息可能已经过时,如有错误请评论留言
使用CSS实现一个比较漂亮的文字阴影效果
效果如下:

代码实现
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
height: 100vh;
background: linear-gradient(45deg, #bfbfbf, #e6e6e6);
display: flex;
justify-content: center;
align-items: center; /* 垂直居中 */
}
h1 {
font-size: 20vmin;
font-family: 'Courier New', Courier, monospace;
line-height: 1;
margin: 0;
letter-spacing: 5px;
color: #e6e6e6;
text-align: center;
text-shadow: 1px -1px #fff, /* 水平偏移1px,垂直偏移1px,白色 */
-1px 1px #999, /* 水平偏移-1px,垂直偏移1px,灰色 */
-10px 10px 5px #80808080; /* 水平偏移-10px,垂直偏移10px,模糊半径5px,灰色 */
}
</style>
</head>
<body>
<h1>Beautiful Shadow Text Effect</h1>
</body>
</html>
第一次见的时候真的觉得很漂亮,特此分享给大家,看完了也去动手实践一下吧



