Advertisement
DidouS

sitewide breakpoints and media queries

Jul 3rd, 2022 (edited)
1,241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 0.47 KB | None | 0 0
  1. $custom-breakpoints: (
  2.     "small"     : 640px,
  3.     "medium"    : 990px,
  4.     "large"     : 1200px,
  5.     "xlarge"    : 1600px,
  6. );
  7.  
  8. // mixins
  9. @mixin breakpoint( $size ) {
  10.     @each $name,$width in $custom-breakpoints {
  11.         @if $name == $size {
  12.             @media screen and (max-width: $width) {
  13.                 @content;
  14.             }
  15.         }
  16.     }
  17. }
  18.  
  19. // use like this:
  20. //
  21. // @include breakpoint( 'small' ) {
  22. //      header {
  23. //          position: fixed;
  24. //      }
  25. // }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement