scss 媒体查询助手
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了scss 媒体查询助手相关的知识,希望对你有一定的参考价值。
// ============================================================
// Media Query Helper
// ============================================================
// @supports
// @media min-width
// @media max-width
// @media min-device-width and max-device-width and orientation landscape
// @media max-height
// @media min-width and max-height
// @syntax
// @include mediaQuery([min, max, minmax, landscape-device, maxheight, null], [pixel_value [,pixel_value]]) {}
@mixin mq($constraint, $viewport1, $viewport2: null) {
@if $constraint == min {
@media screen and ($min: $viewport1) {
@content;
}
} @else if $constraint == max {
@media screen and ($max: $viewport1) {
@content;
}
} @else if $constraint == minmax {
@media screen and ($min: $viewport1) and ($max: $viewport2) {
@content;
}
} @else if $constraint == landscape-device {
@media screen and ($min-device: $viewport1) and ($max-device: $viewport2) and (orientation: landscape) {
@content;
}
} @else if $constraint == maxheight {
@media screen and ($max-height: $viewport1) {
@content;
}
} @else {
@media screen and ($min: $viewport1) and ($max-height: $viewport2) {
@content;
}
}
}
以上是关于scss 媒体查询助手的主要内容,如果未能解决你的问题,请参考以下文章
scss 媒体查询SCSS
scss Bootstrap v4 SCSS媒体查询
scss Vanilla CSS媒体查询+ Sass媒体查询mixin
SCSS 中的媒体查询无法正常工作
SCSS:按媒体查询分组输出
SCSS 媒体查询纵横比不起作用