scss Vanilla CSS媒体查询+ Sass媒体查询mixin
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了scss Vanilla CSS媒体查询+ Sass媒体查询mixin相关的知识,希望对你有一定的参考价值。
//Basic list of media queries based on mobile-first approach:
@media only screen and (min-width:80em) {...} // 1280/16
@media only screen and (min-width:64em) {...} // 1024/16
@media only screen and (min-width:50em) {...} // 800/16
@media only screen and (min-width:48em) {...} // 768/16
@media only screen and (min-width:40em) {...} // 640/16
@media only screen and (min-width:30em) {...} // 480/16
@media only screen and (min-width:20em) {...} // 320/16
@media only screen and (min-width:17.5em) {...} // 280/16
/*
http://css-tricks.com/naming-media-queries/
Usage:
.selector {
width: 25%;
@include bp(S) {
width: 100%;
}
}
*/
@mixin bp($point) {
@if $point == XL { // 1024/16
@media (min-width: 64em) { @content; }
}
@else if $point == L { // 768/16
@media (min-width: 48em) { @content; }
}
@else if $point == M { // 640/16
@media (min-width: 40em) { @content; }
}
@else if $point == S { // 480/16
@media (min-width: 30em) { @content; }
}
@else if $point == XS { // 320/16
@media (min-width: 20em) { @content; }
}
}
以上是关于scss Vanilla CSS媒体查询+ Sass媒体查询mixin的主要内容,如果未能解决你的问题,请参考以下文章
CSS/SCSS 媒体查询或类
scss CSS媒体查询
scss CSS:媒体查询
SCSS 媒体查询纵横比不起作用
CSS/SASS:媒体查询没有被读取/看到[重复]
如何在 CSS 3 媒体查询中使用 SASS 逻辑 [重复]