【发布时间】:2017-08-23 05:51:15
【问题描述】:
当您看到图像时,您会看到带有背景的曲线。我使用svg 创建曲线,但它是纯色。谁能解释一下我如何使用图像作为背景而不是像图片显示的颜色?
我想要达到的目标
我得到了什么
我的代码
.container {
position: relative;
width: 100%;
height: 400px;
background: #333;
bottom: 0;
}
#svg {
width: 200px;
height: 100px;
position: absolute;
left: 50%;
transform: translate(-50%);
bottom: -78px;
z-index: 1000;
}
<div class="container">
<svg id="svg">
<path d="M0 0 C50 20 50 80 100 82 C150 80 150 20 200 0" stroke="none" fill="#333"></path>
</svg>
</div>
<div class="container" style="background: grey; margin-top: -20px"></div>
【问题讨论】: