Last active
June 13, 2018 07:22
-
-
Save liuwenzhuang/0a852ab54d483ee275b9ed694174f398 to your computer and use it in GitHub Desktop.
产生任意角度折角;arbitrary angle folded corner
This file contains hidden or 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 folded-corner($background, $size, $angle: 30deg) { | |
| position: relative; | |
| background: $background; | |
| /* 回退样式 */ | |
| 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); | |
| } | |
| } | |
| /* 当调用时... */ | |
| .note { | |
| @include folded-corner(#38a, 2em, 20deg); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment