使用CSS的mask属性实现头像与国旗的融合
100人浏览 2024-09-08 08:18:13
效果图:

- 所有代码
<!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>Document</title>
<style>
.pic {
position: relative;
margin: auto;
width: 200px;
height: 200px;
/* 头像 */
background: url("pic.jpg") no-repeat;
background-size: cover;
}
.pic::before {
content: "";
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
/* 国旗的图片 */
background: url("china.png") no-repeat;
background-size: cover;
/* 遮罩层 */
-webkit-mask: linear-gradient(110deg, white 10%, transparent 70%, transparent);
}
</style>
</head>
<body>
<div class="pic"></div>
</body>
</html>
相关推荐
-
PHP8种变量类型的详细讲解2025-02-22 00:32:24
-
php+apache 和 php+nginx的区别2025-02-22 00:21:27
-
PHP:与workerman结合实现定时任务2025-02-22 00:15:57
-
Nginx的Rewrite规则与实例2025-02-22 00:15:39
-
MySql中身份证字段的简单脱敏介绍2025-02-22 00:15:36