断点Sass:或查询多个断点 [英] Breakpoint Sass: Or Queries for Multiple Breakpoints

查看:87
本文介绍了断点Sass:或查询多个断点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设置了一些断点:

$breakpoint-tiny : 0 767px;
$breakpoint-small : 768px 991px ;
$breakpoint-medium : 992px 1229px;
$breakpoint-large : 1230px;

我在断点文档中看到了

您还可以编写OR媒体查询,从而可以编写多个 不同的基本或复合媒体查询,并使其适用(如果有) 匹配的查询中的一个.

You can also write OR media queries, allowing you to write multiple different basic or compound media queries and have them apply if any of the sets of queries match.

我想做的是在代码中需要时使用这些或查询来定位多个断点.例如:

What I'd like to do is use these or queries to target multiple breakpoints when needed in my code. For example:

@include breakpoint($breakpoint-medium, $breakpoint-large){
   .mobile-navigation{display: none;}
}

这可能吗?

推荐答案

您应该传递一个参数(列表),而不是两个.

You should pass one parameter (a list), instead of two.

尝试一下.

@include breakpoint(($breakpoint-medium, $breakpoint-large)) {
    .mobile-navigation{display: none;}
}

我用括号将您用逗号分隔的变量包裹了起来. 现在,Sass将它们视为一个列表,而不是两个参数.

I've wrapped your comma separated variables with parentheses. Now Sass will see them as a one list, instead of two parameters.

这篇关于断点Sass:或查询多个断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆