【发布时间】:2016-04-29 23:03:51
【问题描述】:
我有生成否定媒体查询的 sass 代码,如下所示(基于 Exact NOT(Inverse) of CSS Media Query):
@media not screen and (max-width: 420px) {
.phone {
display: none;
}
}
@media not screen and (min-width: 421px) and (max-width: 992px) {
.tablet {
display: none;
}
}
为什么这不适用于具有组合类的最后一个 div?
<div class="phone">visible on: phone</div>
<div class="tablet">visible on: tablet</div>
<div class="phone tablet">visible on: phone and tablet</div>
我颠倒逻辑的原因是因为如果我会以相反的方式来做(显示而不是隐藏)。我不知道每个元素是什么显示类型(块、内联等),我can't set it back to it's previous value。
【问题讨论】:
标签: css media-queries