Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 0.63 KB | None | 0 0
  1. /*
  2.  
  3. by Reno Park <hallo@reno-park.com>
  4. use class="slope top" or class="slope bottom" on any block element
  5.  
  6. */
  7.  
  8. .slope {
  9.   $height: 100px;
  10.   position: relative;
  11.  
  12.   &::before {
  13.     position: absolute;
  14.     width: 100%;
  15.     height: $height;
  16.     left: 0;
  17.     right: 0;
  18.     background-color: rgba(139, 3, 4, 0.78);
  19.     content: "";
  20.     display: block;
  21.   }
  22.  
  23.   &.top::before {
  24.     top: -#{$height};
  25.     -webkit-clip-path: polygon(0 0, 0% 100%, 100% 100%);
  26.     clip-path: polygon(0 0, 0% 100%, 100% 100%);
  27.   }
  28.  
  29.   &.bottom::before {
  30.     bottom: -#{$height};
  31.     -webkit-clip-path: polygon(100% 0, 0 0, 100% 100%);
  32.     clip-path: polygon(100% 0, 0 0, 100% 100%);
  33.   }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement