当前位置: 首页 > news >正文

css设置让整个盒子的内容渐变透明(非颜色渐变透明)

css设置让整个盒子的内容渐变透明(非颜色渐变透明)

  • 效果
  • 核心css代码

效果

在这里插入图片描述

核心css代码

/* 设置蒙版上下左右渐变显示 */
mask-image: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 10%, rgba(0, 0, 0, 1) 90%, rgba(0, 0, 0, 0) 100%),linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 10%, rgba(0, 0, 0, 1) 90%, rgba(0, 0, 0, 0) 100%);
mask-composite: intersect;
<!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>* {padding: 0;margin: 0;}.f-c-c {display: flex;justify-content: center;align-items: center;}.content {width: 100vw;height: 100vh;}.skyblue {width: 500px;height: 500px;background-color: skyblue;/* 设置蒙版上下左右渐变显示 */mask-image: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 10%, rgba(0, 0, 0, 1) 90%, rgba(0, 0, 0, 0) 100%),linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 10%, rgba(0, 0, 0, 1) 90%, rgba(0, 0, 0, 0) 100%);mask-composite: intersect;}.pink {width: 200px;height: 200px;background-color: pink;}.pink {width: 200px;height: 200px;background-color: pink;/* 设置蒙版上下左右渐变显示 */mask-image: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 10%, rgba(0, 0, 0, 1) 90%, rgba(0, 0, 0, 0) 100%),linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 10%, rgba(0, 0, 0, 1) 90%, rgba(0, 0, 0, 0) 100%);mask-composite: intersect;}.yellow {width: 100px;height: 100px;background-color: yellow;}</style>
</head>
<body><div class="content f-c-c"><div class="skyblue f-c-c"><div class="pink"><div class="yellow"></div></div></div></div>
</body>
</html>

http://www.mrgr.cn/news/16337.html

相关文章:

  • Ubuntu中qt类与类信号槽的创建及使用
  • vue3中ref绑定的节点顺序错乱
  • 用友U8 Cloud RepAddToTaskAction SQL注入漏洞复现
  • 如何在华为平板上开发一个web网页
  • 排序算法:
  • IPv6地址子网划分
  • Java:Instant时间
  • Codeforces Round 969 (Div. 2) 题ABC详细题解,包含(C++,Python语言描述)
  • 食家巷中秋美食,味蕾上的团圆盛宴
  • AI跟踪报道第54期-新加坡内哥谈技术-本周AI新闻: OpenAI最新模型揭晓和全AI生成的游戏革命
  • Linux | 进程池技术解析:利用无名管道实现并发任务处理(含实现代码)
  • chapter09-OOP高级部分——(内部类)——day13
  • 站长神器,AI批量生成原创文章工具免费用还能自动发布到站点
  • 高频Postman接口测试面试题
  • 【3.9】贪心算法-解最低加油次数
  • python学习——爬虫之session请求处理cookie
  • Java基础(4)- IDEA
  • 眼镜清洗机哪个品牌好?2024超声波清洗机推荐
  • 时间格式--cotroller传递时间参数
  • OJ-0830**