Last active
March 13, 2025 05:28
-
-
Save witmin/5cdb7a2e3cac9b39f3d6 to your computer and use it in GitHub Desktop.
Simple media queries mixins for phone and tablet. Including variables of the basic mobile size, portrait and landscape orientation in sass. Can be quick applied in a mini site.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Simple media queries mixins for phone and tablet. Including variables of the basic mobile size, portrait and landscape orientation in sass. Can be quick applied in a mini site. | |
// Author: Millie Lin | |
// website: www.millielin.com | |
// ***** Breakpoints for Responsive Screen | |
// width scale for phone | |
$phone-min-width: 320px !default; | |
$phone-max-width: 504px !default; | |
// height scale for phone | |
$phone-min-height: 346px !default; | |
$phone-max-height: 695px !default; | |
// width scale for tablet | |
$tablet-min-width: 480px !default; | |
$tablet-max-width: 1024px !default; | |
// height scale for tablet | |
$tablet-min-height: 800px !default; | |
$tablet-max-height: 1440px !default; | |
// Desktop Scale | |
$desktop-min-height: 768px !default; | |
$desktop-max-height: 1280px !default; | |
// Mixins | |
// For portrait phone and landscape phone | |
@mixin phone(){ | |
@media screen and (min-width: $phone-min-width) and (max-height: $phone-max-height){ | |
@content; | |
} | |
} | |
// For portrait phone | |
@mixin portrait-phone() { | |
@media screen and (min-width: $phone-min-width) and (max-width: $phone-max-width) and (orientation: portrait) { | |
@content; | |
} | |
} | |
// For landscape phone | |
@mixin landscape-phone(){ | |
@media screen and (min-height: $phone-min-height) and (max-height: $phone-max-height) and (orientation: landscape){ | |
@content; | |
} | |
} | |
// For portrait tablet and landscape tablet | |
@mixin tablet(){ | |
@media screen and (min-width: $tablet-min-width) and (max-height: $tablet-max-height){ | |
@content; | |
} | |
} | |
// For portrait tablet | |
@mixin portrait-tablet() { | |
@media screen and (min-width: $tablet-min-width) and (max-width: $tablet-max-width) and (orientation: portrait) { | |
@content; | |
} | |
} | |
// For landscape tablet | |
@mixin landscape-tablet(){ | |
@media screen and (min-height: $tablet-min-height) and (max-height: $tablet-max-height) and (orientation: landscape){ | |
@content; | |
} | |
} | |
// For desktop | |
@mixin desktop(){ | |
@media screen and (min-height: $desktop-min-height) and (max-height: $desktop-max-height){ | |
@content; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Added the media query for desktop