Skip to content

Instantly share code, notes, and snippets.

@igortatarenko
Last active December 25, 2020 13:52
Show Gist options
  • Select an option

  • Save igortatarenko/aba6724b7a2d7570a32c7003569ef364 to your computer and use it in GitHub Desktop.

Select an option

Save igortatarenko/aba6724b7a2d7570a32c7003569ef364 to your computer and use it in GitHub Desktop.
// =============================================================================
// Медиа запросы
// =============================================================================
// меньше указанной величины (по умолчанию ширина)
@mixin below($width, $orientation: 'width') {
@media screen and (max-#{$orientation}: $width) {
@content;
}
}
// больше указанной величины (по умолчанию ширина)
@mixin above($width, $orientation: 'width') {
@media screen and (min-#{$orientation}: $width) {
@content;
}
}
// между первой и второй величиной (по умолчанию ширина)
@mixin between($minWidth, $maxWidth, $orientation: 'width') {
@media screen and (min-#{$orientation}: $minWidth) and (max-#{$orientation}: $maxWidth) {
@content;
}
}
// =============================================================================
// Функции пересчета значений
// =============================================================================
@function rem($num) {
$strip-unit: $num / ($num * 0 + 1);
@return $strip-unit / 16 * 1rem;
}
@function em($num, $root: 16) {
$strip-unit: $num / ($num * 0 + 1);
@return $strip-unit / $root * 1em;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment