使用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>
相关推荐
-
Linux中完全删除nginx并重新安装2025-04-26 01:23:45
-
《前端运维》、Nginx-3静态资源服务、跨域与其他2025-04-26 00:51:36
-
nginx配置SSL总结2025-04-26 00:49:40
-
windows下安装nginx,并注册为系统服务,开机自启动
windows下安装nginx,并注册为系统服务,开机自启动2025-04-26 00:21:28 -
详解nginx利用referer指令实现防盗链配置2025-04-26 00:10:48