Skip to content

Instantly share code, notes, and snippets.

@yuriy-o
Created June 19, 2022 21:15
Show Gist options
  • Save yuriy-o/4d4d95ae25e6edacc553c9f575050150 to your computer and use it in GitHub Desktop.
Save yuriy-o/4d4d95ae25e6edacc553c9f575050150 to your computer and use it in GitHub Desktop.
Миксин для адаптивки
@mixin mq($type) {
$mobile: 480px;
$tablet: 768px;
$desktop: 1200px;
@if $type == 'mobile-only' {
@media screen and (max-width: #{$tablet - 0.02}) {
@content;
}
}
@if $type == 'mobile' {
@media screen and (min-width: $mobile) {
@content;
}
}
@if $type == 'tablet-only' {
@media screen and (min-width: $tablet) and (max-width: #{$desktop - 0.02}) {
@content;
}
}
@if $type == 'tablet' {
@media screen and (min-width: $tablet) {
@content;
}
}
@if $type == 'not-desktop' {
@media screen and (max-width: #{$desktop - 0.02}) {
@content;
}
}
@if $type == 'desktop' {
@media screen and (min-width: $desktop) {
@content;
}
}
@if $type == 'retina' {
@media (min-device-pixel-ratio: 2), (min-resolution: 192dpi), (min-resolution: 2dppx) {
@content;
}
}
}
@yuriy-o
Copy link
Author

yuriy-o commented Aug 6, 2023

➡️ Mobile: Up to 480px
➡️ Extra small devices: 481px to 767px
➡️ Small tablets: 768px to 991px
➡️ Large tablets/laptops: 992px to 1199px
➡️ Desktops: 1200px to 1919px
➡️ Extra large screens: 1920px and up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment