Created
July 9, 2018 11:51
-
-
Save BeardedGinger/4527994d53f90c4a09c88a26d67eb408 to your computer and use it in GitHub Desktop.
Simple Angled Mixin - https://fewerthanthree.com/angled/using-sass-mixin-to-create-anlgled-sections
This file contains 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
@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