I really like the css generated content method of Jeremy Frank - he even provides a cool SASS-Mixin in his article:
https://www.viget.com/articles/angled-edges-with-css-masks-and-transforms
I use this variation alot:
/*
* Angled-edges
*/
@mixin angle($pseudo, $flip: false, $use-background-color: false, $angle: 3deg) {
// $pseudo: before, after, both
@if $pseudo == 'before' or $pseudo == 'after' or $pseudo == 'both' {
position: relative;
z-index: 1;
$selector: if($pseudo == 'both', '&:before,&:after', '&:#{$pseudo}');
#{$selector} {
@if $use-background-color {
background: $color__background-body;
} @else {
background: inherit;
}
content: '';
display: block;
height: 50%;
left: 0;
position: absolute;
right: 0;
z-index: -1;
-webkit-backface-visibility: hidden;
}
@if $pseudo == 'before' {
#{$selector} {
top: 0;
@if $flip {
transform: skewY($angle * -1);
transform-origin: 0 0;
} @else {
transform: skewY($angle);
transform-origin: 100% 0;
}
}
}
@if $pseudo == 'after' {
#{$selector} {
bottom: 0;
@if $flip {
transform: skewY($angle);
transform-origin: 0 100%;
} @else {
transform: skewY($angle * -1);
transform-origin: 100%;
}
}
}
@if $pseudo == 'both' {
&:before {
top: 0;
@if $flip {
transform: skewY($angle * -1);
transform-origin: 0 0;
} @else {
transform: skewY($angle);
transform-origin: 100% 0;
}
}
&:after {
bottom: 0;
@if $flip {
transform: skewY($angle);
transform-origin: 0 0;
} @else {
transform: skewY($angle * -1);
transform-origin: 100%;
}
}
}
}
}