Skip to content

Instantly share code, notes, and snippets.

@justindujardin
Created April 7, 2014 21:14
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justindujardin/10057651 to your computer and use it in GitHub Desktop.
Save justindujardin/10057651 to your computer and use it in GitHub Desktop.
LESS ZigZag Border
/*
border-serrated - a zig zag triangle border with linear gradient
original SASS version: https://gist.github.com/justinmc/9837998
*/
.border-top-serrated(@size, @colorOuter) {
& {
position: relative;
padding-top: @size;
}
&:before {
top: 0px;
background-position: left top;
background:linear-gradient(-135deg, @colorOuter @size / 2, transparent 0), linear-gradient(135deg, @colorOuter @size / 2, transparent 0);
.border-serrated-helper(@size, @colorOuter);
}
}
.border-bottom-serrated(@size, @colorOuter) {
& {
position: relative;
padding-bottom: @size;
}
&:after {
bottom: 0px;
background-position: left bottom;
background:linear-gradient(-45deg, @colorOuter @size / 2, transparent 0), linear-gradient(45deg, @colorOuter @size / 2, transparent 0);
.border-serrated-helper(@size, @colorOuter);
}
}
.border-serrated-helper(@size, @colorOuter) {
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