Advertisement
Guest User

Responsive SASS Mixins

a guest
Jun 21st, 2018
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 3.27 KB | None | 0 0
  1. // Page width
  2. $page-width: 1170px;
  3.  
  4.  
  5. // Responsive resolutions
  6. // source: https://material.google.com/layout/responsive-ui.html#responsive-ui-breakpoints
  7. $desktop-xl: 1920px;
  8. $desktop-l: 1600px;
  9. $desktop-ls: 1550px;
  10. $desktop-m: 1440px;
  11. $desktop-sm: 1400px;
  12. $desktop-s: 1280px;
  13. $desktop-xs: 1200px;
  14. $tablet-xl: 1024px;
  15. $tablet-l: 960px;
  16. $tablet-m: 840px;
  17. $tablet-sm: 768px;
  18. $tablet-s: 720px;
  19. $phone-xl: 600px;
  20. $phone-l: 480px;
  21. $phone-m: 400px;
  22. $phone-s: 360px;
  23. $iphone: 320px;
  24.  
  25.  
  26. /* BEGIN MIXINS */
  27. @mixin page-width {
  28.   @media (max-width: #{$page-width}) {
  29.     @content;
  30.   }
  31. }
  32.  
  33. @mixin page-width-min {
  34.   @media (min-width: #{$page-width}) {
  35.     @content;
  36.   }
  37. }
  38.  
  39. @mixin desktop-xl {
  40.   @media (max-width: #{$desktop-xl}) {
  41.     @content;
  42.   }
  43. }
  44.  
  45. @mixin desktop-xl-min {
  46.   @media (min-width: #{$desktop-xl}) {
  47.     @content;
  48.   }
  49. }
  50.  
  51. @mixin desktop-l {
  52.   @media (max-width: #{$desktop-l}) {
  53.     @content;
  54.   }
  55. }
  56.  
  57. @mixin desktop-l-min {
  58.   @media (min-width: #{$desktop-l}) {
  59.     @content;
  60.   }
  61. }
  62.  
  63. @mixin desktop-ls-min {
  64.   @media (min-width: #{$desktop-ls}) {
  65.     @content;
  66.   }
  67. }
  68.  
  69. @mixin desktop-m {
  70.   @media (max-width: #{$desktop-m}) {
  71.     @content;
  72.   }
  73. }
  74.  
  75. @mixin desktop-sm-min {
  76.   @media (min-width: #{$desktop-sm}) {
  77.     @content;
  78.   }
  79. }
  80.  
  81. @mixin desktop-m-min {
  82.   @media (min-width: #{$desktop-m}) {
  83.     @content;
  84.   }
  85. }
  86.  
  87. @mixin desktop-s {
  88.   @media (max-width: #{$desktop-s}) {
  89.     @content;
  90.   }
  91. }
  92.  
  93. @mixin desktop-xs {
  94.   @media (max-width: #{$desktop-xs}) {
  95.     @content;
  96.   }
  97. }
  98.  
  99. @mixin desktop-s-min {
  100.   @media (min-width: #{$desktop-s}) {
  101.     @content;
  102.   }
  103. }
  104.  
  105. @mixin desktop-xs-min {
  106.   @media (min-width: #{$desktop-xs}) {
  107.     @content;
  108.   }
  109. }
  110.  
  111. @mixin tablet-xl {
  112.   @media (max-width: #{$tablet-xl}) {
  113.     @content;
  114.   }
  115. }
  116.  
  117. @mixin tablet-xl-min {
  118.   @media (min-width: #{$tablet-xl}) {
  119.     @content;
  120.   }
  121. }
  122.  
  123. @mixin tablet-l {
  124.   @media (max-width: #{$tablet-l}) {
  125.     @content;
  126.   }
  127. }
  128.  
  129. @mixin tablet-l-min {
  130.   @media (min-width: #{$tablet-l}) {
  131.     @content;
  132.   }
  133. }
  134.  
  135. @mixin tablet-m {
  136.   @media (max-width: #{$tablet-m}) {
  137.     @content;
  138.   }
  139. }
  140.  
  141. @mixin tablet-m-min {
  142.   @media (min-width: #{$tablet-m}) {
  143.     @content;
  144.   }
  145. }
  146.  
  147. @mixin tablet-sm {
  148.   @media (max-width: #{$tablet-sm}) {
  149.     @content;
  150.   }
  151. }
  152.  
  153. @mixin tablet-sm-min {
  154.   @media (min-width: #{$tablet-sm}) {
  155.     @content;
  156.   }
  157. }
  158.  
  159. @mixin tablet-s {
  160.   @media (max-width: #{$tablet-s}) {
  161.     @content;
  162.   }
  163. }
  164.  
  165. @mixin tablet-s-min {
  166.   @media (min-width: #{$tablet-s}) {
  167.     @content;
  168.   }
  169. }
  170.  
  171. @mixin phone-xl {
  172.   @media (max-width: #{$phone-xl}) {
  173.     @content;
  174.   }
  175. }
  176.  
  177. @mixin phone-xl-min {
  178.   @media (min-width: #{$phone-xl}) {
  179.     @content;
  180.   }
  181. }
  182.  
  183. @mixin phone-l {
  184.   @media (max-width: #{$phone-l}) {
  185.     @content;
  186.   }
  187. }
  188.  
  189. @mixin phone-l-min {
  190.   @media (min-width: #{$phone-l}) {
  191.     @content;
  192.   }
  193. }
  194.  
  195. @mixin phone-m {
  196.   @media (max-width: #{$phone-m}) {
  197.     @content;
  198.   }
  199. }
  200.  
  201. @mixin phone-m-min {
  202.   @media (min-width: #{$phone-m}) {
  203.     @content;
  204.   }
  205. }
  206.  
  207. @mixin phone-s {
  208.   @media (max-width: #{$phone-s}) {
  209.     @content;
  210.   }
  211. }
  212.  
  213. @mixin phone-s-min {
  214.   @media (min-width: #{$phone-s}) {
  215.     @content;
  216.   }
  217. }
  218.  
  219. @mixin iphone {
  220.   @media (max-width: #{$phone-s}) {
  221.     @content;
  222.   }
  223. }
  224. /* END MIXINS */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement