Skip to content

Instantly share code, notes, and snippets.

@Allenice
Created September 3, 2017 14:33
Show Gist options
  • Save Allenice/f8d2d3a45b6ec75145f7a440e57ef6f7 to your computer and use it in GitHub Desktop.
Save Allenice/f8d2d3a45b6ec75145f7a440e57ef6f7 to your computer and use it in GitHub Desktop.
folded-corner
@mixin folded-corner($background, $size, $angle, 30deg) {
position: relative;
background: linear-gradient($angle - 180deg, transparent $size, $background, 0);
border-radius: .5em;
$x: $size / sin($angle);
$y: $size / cos($angle);
&::before {
content: "";
position: absolute;
top: 0;
right: 0;
background: linear-gradient(to left bottom, transparent 50%, rgba(0,0,0,.2) 0, rgba(0,0,0,.4)) 100% 0 no-repeat);
width: $y;
height: $x;
transform: translateY($y - $x) rotate(2 * $angle - 90deg);
transform-origin: bottom right;
border-bottom-left-radius: inherit;
box-shadow: -.2em .2em .3em -.1em rgba(0, 0, 0, .2);
}
}
@Allenice
Copy link
Author

Allenice commented Sep 3, 2017

sin / cos use mathsass: https://github.com/terkel/mathsass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment