带有边的可伸缩剪切路径多边形

问题描述 投票:0回答:1

似乎Edge不能处理剪切路径多边形。如何使用Edge进行这项工作?

.background {
  background-color: grey;
}

.content {
  background: yellow;
  height: 240px;
  display: flex;
  justify-content: center;
  align-items: center;
  clip-path: polygon(0 0, 100% 0, 100% 95%, 0 85%);
}
<div class="background">
  <div class="content">
    <h1>
      Content
    </h1>
  </div>
</div>

https://jsfiddle.net/topsu/79sx26yb/11/

css svg polygon clip-path
1个回答
0
投票

用背景色替换:

.background {
      background-color: grey;
}
.content {
  height: 240px;
  display: flex;
  justify-content: center;
  align-items: center;
  position:relative;
 z-index:0;
}
.content:before {
 content:"";
 position:absolute;
 z-index:-1;
 top:0;
 left:0;
 right:0;
 bottom:5%;  
 background: 
    linear-gradient(yellow,yellow)                           top   /100% 90%,
    linear-gradient(to top right,transparent 48%,yellow 50%) bottom/100% 10%;
 background-repeat:no-repeat;
}
<div class="background">
  <div class="content">
    <h1>
      Content
    </h1>
  </div>
</div>
© www.soinside.com 2019 - 2024. All rights reserved.