Last active
February 2, 2019 21:14
-
-
Save justinmc/9837998 to your computer and use it in GitHub Desktop.
SASS Zigzag Border
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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; | |
} |
@justindujardin Nice LESS version, thanks for linking that.
I've made a sass/svg mixin for zigzag borders: http://codepen.io/gilbarbara/pen/pvwmEb
@include background
where's this one defined?
I see, bourbon.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is great, thanks. I needed a LESS version: https://gist.github.com/justindujardin/10057651