Skip to content

Instantly share code, notes, and snippets.

@frankstallone
Created February 9, 2017 12:19
Show Gist options
  • Save frankstallone/f060e0fd04fbe45bbec5597f42ff3b3c to your computer and use it in GitHub Desktop.
Save frankstallone/f060e0fd04fbe45bbec5597f42ff3b3c to your computer and use it in GitHub Desktop.
SCSS Mixin for media queries that target iPhone 5/s, 6/s, 6/s Plus in portrait mode
/*
* Media Queries for 📱 5 📱 6 & 📱 6+ in Portrait Mode
*
* Note: Do these in order of smallest to largest
* Example:
*
* @include respond-to(iPhone5) { top: 10px; }
* @include respond-to(iPhone6) { top: 12px; }
* @include respond-to(iPhone6Plus) { top: 14px; }
*
*/
@mixin respond-to($media) {
@if $media == iPhone5 {
@media only screen and (min-device-width : 320px) and (max-device-width : 568px) and (orientation : portrait) and (-webkit-min-device-pixel-ratio: 2) {
@content;
}
}
@else if $media == iPhone6 {
@media only screen and (min-device-width : 375px) and (max-device-width : 667px) and (orientation : portrait) and (-webkit-min-device-pixel-ratio: 2) {
@content;
}
}
@else if $media == iPhone6Plus {
@media only screen and (min-device-width : 414px) and (max-device-width : 736px) and (-webkit-min-device-pixel-ratio: 3) and (orientation : portrait) {
@content;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment