【发布时间】:2016-08-21 14:30:42
【问题描述】:
不确定如何命名(如果其他人有更好的标题,请随意编辑帖子),但基本上客户希望顶部的一条粉红色和一条紫色的响应弧线,如屏幕截图所示:
我目前正在使用元素(粉红色)a ::before(紫色区域)和一个 ::after(粉红色线)来完成此操作(因为图像响应不足)现在我需要一个图像滑块来窥视在它下面,但目前它被它之前的层所覆盖:
它需要看起来像这样的模型:
有什么办法可以实现吗?
html:
<div class="topbar">
<div class="container">
<div class="logo"></div>
</div>
</div>
<div class="container firstbelow"></div>
css:
.topbar {
position: relative;
width: 100%;
height: 200px;
background: pink;
overflow: hidden;
z-index: 5;
}
.topbar:after {
position: absolute;
content: "";
left: -20%;
top: 50%;
width: 140%;
height: 300px;
background: rgb(250, 244, 255);
background-repeat: no-repeat;
background-position: center top;
border-radius: 100% 0 0 0 / 90%;
border-top: 5px solid #ff88bb;
z-index: 5;
}
.topbar:before {
position: absolute;
content: "";
left: -20%;
top: 42%;
width: 140%;
height: 150%;
background: #8855bb;
box-shadow: inset 10px -10px 5px -10px #000;
border-radius: 80% 0 0 0 / 60%;
-ms-transform: rotate(-3deg);
-webkit-transform: rotate(-3deg);
transform: rotate(-1deg);
z-index: 5;
}
.firstbelow {
margin-top: -95px;
height: 300px;
background-image: url(../images/slider/Commercial.png);
z-index: 4
}
(注意:是的,我知道 ::after 元素具有白色背景。如果没有,则粉红色和 putple 层会显示出来,我仍然看不到滑块图像)
【问题讨论】:
-
很确定你需要一个剪辑或蒙版。或许可以考虑使用 SVG 或分级解决方案。
标签: html css image css-shapes