在css左侧的锯齿形边界

时间:2018-03-16 14:07:35

标签: html css zigzag

如何将锯齿形边框移到左侧?

  .zigzag {
  height: 150px;
  width: 400px;
  background: linear-gradient(-135deg, #e8117f 5px, transparent 0) 0 5px, linear-gradient(135deg, #e8117f 5px, #fff 0) 0 5px;
  background-color: #e8117f;
  background-position: left bottom;
  background-repeat: repeat-x;
  background-size: 10px 10px;
<div class="zigzag"></div>

THX

enter image description here

1 个答案:

答案 0 :(得分:4)

您应该能够更改线性渐变度以实现此目的,background-repeat设置为repeat-y

  .zigzag {
    height: 150px;
    width: 400px;
    background: linear-gradient(-137deg, #e8117f 6px, transparent 0) 0 5px, linear-gradient(320deg, #e8117f 5px, #fff 0) 0 5px;
    background-color: #e8117f;
    background-position: left bottom;
    background-repeat: repeat-y;
    background-size: 10px 10px;
 }
<div class="zigzag"></div>