Skip to content

Instantly share code, notes, and snippets.

@cywtf
Last active June 23, 2017 16:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cywtf/354d1d327efdc4e061f2d5e2212ab72e to your computer and use it in GitHub Desktop.
Save cywtf/354d1d327efdc4e061f2d5e2212ab72e to your computer and use it in GitHub Desktop.
mq
// MEDIA QUERIES
$breakpoints: (
phone: 599px,
tablet: 600px,
desktop: 1200px,
big-desktop: 1800px
);
/* phone */
@mixin phone--only {
@media (max-width: #{map-get( $breakpoints, phone )}) {
@content;
}
}
@mixin phone--portrait {
@media (max-width: #{map-get( $breakpoints, phone )}) and ( orientation: portrait) {
@content;
}
}
@mixin phone--landscape {
@media (max-width: #{map-get( $breakpoints, phone )}) and ( orientation: landscape) {
@content;
}
}
/* tablet */
@mixin tablet--up {
@media (min-width: #{map-get( $breakpoints, tablet )}) {
@content;
}
}
@mixin tablet--only {
@media (min-width: #{map-get( $breakpoints, phone )}) and ( max-width: #{map-get( $breakpoints, desktop )}) {
@content;
}
}
@mixin tablet--portrait {
@media (min-width: #{map-get( $breakpoints, tablet )}) and ( orientation: portrait) {
@content;
}
}
@mixin tablet--landscape {
@media (min-width: #{map-get( $breakpoints, tablet )}) and ( orientation: landscape) {
@content;
}
}
/* desktop */
@mixin desktop--up {
@media (min-width: #{map-get( $breakpoints, desktop )}) {
@content;
}
}
@mixin desktop--only {
@media (min-width: #{map-get( $breakpoints, tablet )}) and ( max-width: #{map-get( $breakpoints, big-desktop )}) {
@content;
}
}
@mixin desktop--portrait {
@media (min-width: #{map-get( $breakpoints, desktop )}) and ( orientation: portrait) {
@content;
}
}
@mixin desktop--landscape {
@media (min-width: #{map-get( $breakpoints, desktop )}) and ( orientation: landscape) {
@content;
}
}
/* big-desktop */
@mixin big-desktop--up {
@media (min-width: #{map-get( $breakpoints, big-desktop )}) {
@content;
}
}
@mixin big-desktop--portrait {
@media (min-width: #{map-get( $breakpoints, big-desktop )}) and ( orientation: portrait) {
@content;
}
}
@mixin big-desktop--landscape {
@media (min-width: #{map-get( $breakpoints, big-desktop )}) and ( orientation: landscape) {
@content;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment