css - 如何在 HTML div 中添加透明凹槽?
问题描述
我需要一个特殊形状的工作流组件。这是我同事的解决方案。
.workflow-item {
display: flex;
flex-direction: row;
align-items: center;
width: 100%;
}
.item-no {
display: flex;
align-items: center;
justify-content: center;
width: 40px;
height: 40px;
border-radius: 50%;
background-color: green;
flex-shrink: 0;
border: 1px solid yellow;
}
.content {
display: flex;
flex-direction: row;
align-items: center;
width: 100%;
height: 40px;
padding-left: 40px;
margin-left: -40px;
border-left: none;
border-top-right-radius: 20px;
border-bottom-right-radius: 20px;
background: radial-gradient(
circle at 0px 20px,
rgba(0, 0, 0, 0) 25px, red 25px)
20px 0px no-repeat;
}
<div class="workflow-item">
<div class="item-no"></div>
<div class="content">
<div class="item-text"></div>
</div>
</div>
<div class="connection"></div>
问题是右侧形状的凹槽是通过使用左侧白色的径向渐变制成的。但是我们不知道背景的颜色。所以我尝试用CSS clip-path和/或mask创建这个特殊的形状,但我没有做对。
如何在右侧创建形状以使其适用于任何背景?
解决方案
推荐阅读
- msbuild - 适用于 MSBuild 的 SonarQube 扫描仪:SonarQube 无法收集有关您的项目的所需信息
- wordpress - 如何使用 css 为不同的页面添加单独的标题图像
- object-detection - 我应该为验证图像创建 json 注释吗?
- javascript - javascript Date 对象中的时区问题
- javascript - 在数组中查找薪水最高的部门
- python - 在查询中使用 ndb IN 运算符
- ide - 为什么 WebStorm IDE 中的文件无法正常工作?
- python - 为什么我在生成pdf时在reportlab中出现“内存错误”
- docker - 如何使用 BUILDBOT_CONFIG_URL 配置 buildbot docker 容器
- angular - 从 API 请求 Angular 添加路由不适用于 SSR