Try โ€‚HackMD Logoโ€‰HackMD

Media query basic breakpoint

Media query manager

Those breakpoints are what I prefer to using.

Standard

  • breakpoints

    • 0 - 600px : phone
    • 600 - 900px : Tablet portrait
    • 900 - 1200px : Tablet landscape
    • 1200 - 1800 : is where our normal styles apply
    • 1800px+ : Big desktop
  • $breakpoint argument choices:

    • phone
    • tab-port
    • tab-land
    • big-desktop

ORDER: Base + typography > general layout + grid > page layout > components

โ€‹โ€‹โ€‹โ€‹1rem = 16px

rem is best option for media query

Example

Breakpoint variable (<project-root>/sass/abstracts/_mixins.scss)

โ€‹โ€‹โ€‹โ€‹// MEDIA QUERY MANAGER

โ€‹โ€‹โ€‹โ€‹/*
โ€‹โ€‹โ€‹โ€‹0 - 600px:     phone
โ€‹โ€‹โ€‹โ€‹600 - 900px:   Tablet portrait 
โ€‹โ€‹โ€‹โ€‹900 - 1200px:  Tablet landscape
โ€‹โ€‹โ€‹โ€‹[1200 - 1800]: is where our normal styles apply
โ€‹โ€‹โ€‹โ€‹1800px + :     Big desktop
โ€‹โ€‹โ€‹โ€‹*/

โ€‹โ€‹โ€‹โ€‹/*
โ€‹โ€‹โ€‹โ€‹$breakpoint argument choices:
โ€‹โ€‹โ€‹โ€‹- phone
โ€‹โ€‹โ€‹โ€‹- tab-port
โ€‹โ€‹โ€‹โ€‹- tab-land
โ€‹โ€‹โ€‹โ€‹- big-desktop
โ€‹โ€‹โ€‹โ€‹ORDER: Base + typography > general layout + grid > page layout > components
โ€‹โ€‹โ€‹โ€‹1em = 16px
โ€‹โ€‹โ€‹โ€‹[em] is best option for media query
โ€‹โ€‹โ€‹โ€‹*/

โ€‹โ€‹โ€‹โ€‹@mixin respond($breakpoint) {
โ€‹โ€‹โ€‹โ€‹  @if $breakpoint == phone {
โ€‹โ€‹โ€‹โ€‹    @media (max-width: 37.5em) {
โ€‹โ€‹โ€‹โ€‹      //600px
โ€‹โ€‹โ€‹โ€‹      @content;
โ€‹โ€‹โ€‹โ€‹    }
โ€‹โ€‹โ€‹โ€‹  }
โ€‹โ€‹โ€‹โ€‹  @if $breakpoint == tab-port {
โ€‹โ€‹โ€‹โ€‹    @media (max-width: 56.25em) {
โ€‹โ€‹โ€‹โ€‹      //900px
โ€‹โ€‹โ€‹โ€‹      @content;
โ€‹โ€‹โ€‹โ€‹    }
โ€‹โ€‹โ€‹โ€‹  }
โ€‹โ€‹โ€‹โ€‹  @if ($breakpoint == tab-land) {
โ€‹โ€‹โ€‹โ€‹    @media (max-width: 75em) {
โ€‹โ€‹โ€‹โ€‹      //1200px
โ€‹โ€‹โ€‹โ€‹      @content;
โ€‹โ€‹โ€‹โ€‹    }
โ€‹โ€‹โ€‹โ€‹  }
โ€‹โ€‹โ€‹โ€‹  @if ($breakpoint == big-desktop) {
โ€‹โ€‹โ€‹โ€‹    @media (min-width: 112.5em) {
โ€‹โ€‹โ€‹โ€‹      //1800px
โ€‹โ€‹โ€‹โ€‹      @content;
โ€‹โ€‹โ€‹โ€‹    }
โ€‹โ€‹โ€‹โ€‹  }
โ€‹โ€‹โ€‹โ€‹}

Include breakpoint (?.scss) ex:

โ€‹โ€‹โ€‹โ€‹ @include respond(tab-port) {
โ€‹โ€‹โ€‹โ€‹    padding: 20rem 0rem;
โ€‹โ€‹โ€‹โ€‹  }

Reference