Advertisement
Guest User

Untitled

a guest
Dec 6th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. //variables
  2. $mobile: 320px;
  3. $tablet: 768px
  4. $desktop: 1200px;
  5.  
  6. //mixin
  7. @mixin MQ($canvas) {
  8. @else if $canvas == mobile {
  9. @media only screen and (min-width: $mobile) and (max-width: $mobile - 1) { @content; }
  10. }
  11. @else if $canvas == tablet {
  12. @media only screen and (min-width: $tablet) and (max-width: $desktop - 1) { @content; }
  13. }
  14. @else if $canvas == desktop {
  15. @media only screen and (min-width: $desktop) { @content; }
  16. }
  17.  
  18. @else if $canvas == mobilePlus {
  19. @media only screen and (min-width: $mobile) { @content; }
  20. }
  21. @else if $canvas == tabletPlus {
  22. @media only screen and (min-width: $tablet) { @content; }
  23. }
  24. @else if $canvas == desktopPlus {
  25. @media only screen and (min-width: $desktop) { @content; }
  26. }
  27.  
  28. @else if $canvas == mobileNeg {
  29. @media only screen and (max-width: $mobile) { @content; }
  30. }
  31. @else if $canvas == tabletNeg {
  32. @media only screen and (max-width: $tablet) { @content; }
  33. }
  34. @else if $canvas == desktopNeg {
  35. @media only screen and (max-width: $desktop) { @content; }
  36. }
  37. }
  38.  
  39. //demonstration of use
  40. .h1 {
  41. @include MQ(mobile) {
  42. font-size: 0.9em;
  43. }
  44. @include MQ(tabletPlus) {
  45. font-size: 1em;
  46. }
  47. @include MQ(desktopNeg) {
  48. font-size: 1.1em;
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement