真的很喜欢这个问答。
但是,它只能处理面朝下的曲折。
我在这里为上/右/左/右方向添加 SCSS 解决方案。
希望这对其他人有用。
@mixin zigzag_downward( $color ){
background: linear-gradient( 45deg, transparent 75%, $color 75%) 0 50%,
linear-gradient(-45deg, transparent 75%, $color 75%) 0 50%;
background-repeat: repeat-x;
background-size:30px 30px, 30px 30px;
}
@mixin zigzag_upward( $color ){
background: linear-gradient( 45deg, $color 25%, transparent 25%) 0 50%,
linear-gradient(-45deg, $color 25%, transparent 25%) 0 50%;
background-repeat: repeat-x;
background-size:30px 30px, 30px 30px;
}
@mixin zigzag_left( $color ){
background: linear-gradient( 45deg, transparent 75%, $color 75%) 0% 0,
linear-gradient(135deg, transparent 75%, $color 75%) 0% 0%;
background-repeat: repeat-y;
background-size:30px 30px, 30px 30px;
}
@mixin zigzag_right( $color ){
background: linear-gradient( 45deg, $color 25%, transparent 25%) 0% 0,
linear-gradient(135deg, $color 25%, transparent 25%) 0% 0%;
background-repeat: repeat-y;
background-size:30px 30px, 30px 30px;
}
这是一个代码笔示例:http ://codepen.io/anon/pen/HjJBF