Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. // Convert PX to REM
  2. $browser-context: 16; // Default
  3. @function rem($pixels, $context: $browser-context) {
  4. @return #{$pixels/$context}rem;
  5. }
  6.  
  7. // Margin/Padding helpers
  8. $step : 5;
  9. $from : 0;
  10. $through : ceil( 100 /$step);
  11. $unit : 'px';
  12. @for $i from $from through $through {
  13. $i : $i * $step;
  14.  
  15. // Margin Top
  16. .mt-#{$i} {margin-top:rem($i)}
  17.  
  18. // Margin Right
  19. .mr-#{$i} {margin-right:rem($i)}
  20.  
  21. // Margin Bottom
  22. .mb-#{$i} {margin-bottom:rem($i)}
  23.  
  24. // Margin Left
  25. .ml-#{$i} {margin-left:rem($i)}
  26.  
  27. // Margin All
  28. .ma-#{$i} {margin:rem($i)}
  29.  
  30. // Padding Top
  31. .pt-#{$i} {padding-top:rem($i)}
  32.  
  33. // Padding Right
  34. .pr-#{$i} {padding-right:rem($i)}
  35.  
  36. // Padding Bottom
  37. .pb-#{$i} {padding-bottom:rem($i)}
  38.  
  39. // Padding Left
  40. .pl-#{$i} {padding-left:rem($i)}
  41.  
  42. // Padding All
  43. .pa-#{$i} {padding:rem($i)}
  44. }
  45.  
  46. // Reset h* margins to 0
  47. @for $i from 1 through 6 {
  48. h#{$i} {margin:0}
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement