Advertisement
arxeiss

SASS Clearfix

Oct 7th, 2016
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 0.63 KB | None | 0 0
  1. @mixin clearfix($before, $after){
  2.     @if $before{
  3.         &:before{
  4.             content: '';
  5.             clear: both;
  6.             display: block;
  7.             width: 100%;
  8.         }
  9.     }
  10.     @if $after{
  11.         &:after{
  12.             content: '';
  13.             clear: both;
  14.             display: block;
  15.             width: 100%;
  16.         }        
  17.     }
  18. }
  19.  
  20. .clearfix--after:after{
  21.     @include clearfix(false, true)
  22. }
  23. .clearfix--before:before{
  24.     @include clearfix(true, false)
  25. }
  26. .clearfix{
  27.     @extend .clearfix--after;
  28.     @extend .clearfix--before;
  29. }
  30. .clear{
  31.     clear: both;
  32.     display: block;
  33.     width: 100%;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement