Last active
February 22, 2017 04:04
-
-
Save Scretch-1/0f577b6ce466cf1f4c7cda0f344a9f31 to your computer and use it in GitHub Desktop.
Полезные миксины для адаптирования проектов (.scss)
This file contains hidden or 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
//-- В ФАЙЛ _vars.sass --// | |
//font-size | |
$df: 1em; | |
//font-media | |
$dfm: 3.3vw; | |
// Media enquiries | |
$large: 1199px; | |
$medium: 991px; | |
$small: 767px; | |
$smallm: 600px; | |
$extrasmall: 320px; | |
//-- В ФАЙЛ _mixins.sass | |
// font media style | |
@mixin fms($fz: $df, $fm: $dfm) { | |
font-size: $fz; | |
@media screen and (max-width: 600px) { | |
font-size: $fm; | |
} | |
} | |
// Media enquiries | |
@mixin lg($media) { | |
@if $media == min-w { | |
@media only screen and (min-width: $large) { | |
@content; | |
} | |
} | |
} | |
@mixin md($media) { | |
@if $media == max-w { | |
@media only screen and (max-width: $large) { | |
@content; | |
} | |
} | |
@else if $media == med-w { | |
@media only screen and (min-width: $medium + 1) and (max-width: $large - 1) { | |
@content; | |
} | |
} | |
@else if $media == min-w { | |
@media only screen and (min-width: $medium) { | |
@content; | |
} | |
} | |
} | |
@mixin sm($media) { | |
@if $media == max-w { | |
@media only screen and (max-width: $medium) { | |
@content; | |
} | |
} | |
@else if $media == med-w { | |
@media only screen and (min-width: $small + 1) and (max-width: $medium - 1) { | |
@content; | |
} | |
} | |
@else if $media == min-w { | |
@media only screen and (min-width: $small) { | |
@content; | |
} | |
} | |
} | |
@mixin sml($media) { | |
@if $media == max-w { | |
@media only screen and (max-width: $small) { | |
@content; | |
} | |
} | |
@else if $media == med-w { | |
@media only screen and (min-width: $smallm + 1) and (max-width: $small - 1) { | |
@content; | |
} | |
} | |
@else if $media == min-w { | |
@media only screen and (min-width: $smallm) { | |
@content; | |
} | |
} | |
} | |
@mixin xs($media) { | |
@if $media == max-w { | |
@media only screen and (max-width: $smallm) { | |
@content; | |
} | |
} | |
@else if $media == med-w { | |
@media only screen and (min-width: $extrasmall + 1) and (max-width: $small - 1) { | |
@content; | |
} | |
} | |
@else if $media == min-w { | |
@media only screen and (min-width: $extrasmall) { | |
@content; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment