带有Edge的可扩展剪切路径多边形

时间:2019-10-19 14:57:42

标签: css svg polygon clip-path

似乎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/

1 个答案:

答案 0 :(得分:2)

用背景色替换它:

.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>