Skip to content

Instantly share code, notes, and snippets.

@saas786
Forked from justinmc/gist:9837998
Created September 27, 2017 07:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saas786/38ddb5625bf194a8dd224bc43c145fca to your computer and use it in GitHub Desktop.
Save saas786/38ddb5625bf194a8dd224bc43c145fca to your computer and use it in GitHub Desktop.
SASS Zigzag Border
/* border-serrated - a zig zag triangle border with linear gradient
*/
@mixin border-top-serrated($size, $color-outer) {
& {
position: relative;
overflow: auto;
padding-top: $size;
}
&:before {
top: 0px;
background-position: left top;
@include background(linear-gradient(-135deg, $color-outer $size / 2, transparent 0), linear-gradient(135deg, $color-outer $size / 2, transparent 0));
@include border-serrated-helper($size, $color-outer);
}
}
@mixin border-bottom-serrated($size, $color-outer) {
& {
position: relative;
overflow: auto;
padding-bottom: $size;
}
&:after {
bottom: 0px;
background-position: left bottom;
@include background(linear-gradient(-45deg, $color-outer $size / 2, transparent 0), linear-gradient(45deg, $color-outer $size / 2, transparent 0));
@include border-serrated-helper($size, $color-outer);
}
}
@mixin border-serrated-helper($size, $color-outer) {
content: " ";
display: block;
position: absolute;
left: 0px;
width: 100%;
height: $size;
background-repeat: repeat-x;
background-size: $size $size;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment