【问题标题】:Confusion around the not-small breakpoint in tachyons快子中不小的断点周围的混乱
【发布时间】:2021-03-06 19:45:50
【问题描述】:

使用tachyons css 库:

我不明白ns 断点是如何工作的。根据文档,断点定义为:

Media Query Extensions:
  -ns = not-small [ @media screen and (min-width: 30em) ]
  -m  = medium [ @media screen and (min-width: 30em) and (max-width: 60em) ]
  -l  = large [ @media screen and (min-width: 60em) ]

  

认为下面的代码将确保只有单个 div 的可见性取决于宽度。

<div class="dn-ns dn-m dn-l">Mobile</div>
<div class="dn db-ns">Small</div>
<div class="dn db-m">Medium</div>
<div class="dn db-l">Large</div>

但是,ns 断点似乎也出现在 mediumlarge 断点处。

mobile breakpoint, it's default

ns and medium, both kicking in

ns and large, both visible

是不是因为ns 断点没有指定上限,所以覆盖了所有非移动设备?

【问题讨论】:

  • 是的,宽度为 30em 或以上的任何东西都会在 ns 媒体查询中进行设置。就是说不小。

标签: css responsive-design media-queries tachyons-css


【解决方案1】:

ns 断点意味着该类将适用于所有不小的尺寸(min-width:30em // 只有移动设备的宽度低于 30em,因此 ns 将适用于平板电脑、台式机、大型显示设备宽度)

<!---display: none on all devices which are not small(dn-m and dn-l are redundant here) --->
<div class="dn-ns dn-m dn-l">Mobile</div> 
  

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-08
    • 1970-01-01
    • 2014-09-12
    • 2017-10-31
    • 1970-01-01
    相关资源
    最近更新 更多