Skip to content

Instantly share code, notes, and snippets.

@BeardedGinger
Created July 9, 2018 11:51
Show Gist options
  • Save BeardedGinger/4527994d53f90c4a09c88a26d67eb408 to your computer and use it in GitHub Desktop.
Save BeardedGinger/4527994d53f90c4a09c88a26d67eb408 to your computer and use it in GitHub Desktop.
@mixin angled( $background-color, $reversed: false, $height: '1.5deg' ) {
position: relative;
&::before,
&::after {
display: block;
background-color: $background-color;
right: 0;
content: '';
height: 50%;
z-index: -1;
}
&::before {
top: 0;
transform: skewY( #{$height} );
transform-origin: top right;
}
&::after {
bottom: 0;
transform: skewY( #{$height} );
transform-origin: bottom left;
}
@if $reversed {
&::before {
transform: skewY( -#{$height} );
transform-origin: top left;
}
&::after {
transform: skewY( -#{$height} );
transform-origin: bottom right;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment