You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何创建相交且重叠区域属性一致的半透明块(云朵效果)

问题:实现无重叠颜色加深的半透明相交块(云朵效果)

我想要创建两个相交的半透明块,要求重叠区域和单个块的颜色、透明度等属性完全一致,用来实现云朵效果。但目前写的CSS代码会让重叠区域颜色加深,以下是尝试的代码、实际效果截图和期望效果截图:

尝试的代码

CSS代码

.parent {
  position: relative;
  width: 200px;
  height: 200px;
}

.child {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.child-1 {
  background-color: rgba(255, 123, 0, 0.5);
  z-index: 2;
}

.child-2 {
  background-color: rgba(255, 123, 0, 0.5);
  top: 20px;
  left: 20px;
  z-index: 2;
}

.child-1,
.child-2 {
  isolation: isolate;
}

HTML代码

<div class="parent">
  <div class="child child-1"></div>
  <div class="child child-2"></div>
</div>

效果对比

实际效果

实际效果

期望效果

期望效果

内容的提问来源于stack exchange,提问作者rahunak

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.23 03:15:12