语义-UI:如何仅在移动设备上隐藏元素? [英] semantic-ui: how to hide element on mobile only?

查看:7
本文介绍了语义-UI:如何仅在移动设备上隐藏元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只需要在移动设备上隐藏一些元素,例如图像。如何使用语义用户界面实现这一点?

角材质中是否有"Hide-X",引导中是否有"Hide-X"?

我通读了文档,但找不到任何类似的东西。我找到的所有内容都是some options for a grid,但我不想使用网格,只是为了使元素在某些设备上不可见...

<div class="ui grid">
  <div class="two column mobile only row">
    <div class="column">
      <div class="ui segment">
        Mobile only
      </div>
    </div>
  </div>
</div>

我还发现了some solution here on SO,其中有人建议编写一些额外的CSS。如下所示:

/* Mobile */

@media only screen and (max-width: 767px) {
  [class*="mobile hidden"],
  [class*="tablet only"]:not(.mobile),
  [class*="computer only"]:not(.mobile),
  [class*="large monitor only"]:not(.mobile),
  [class*="widescreen monitor only"]:not(.mobile),
  [class*="or lower hidden"] {
    display: none !important;
  }
}

真的要走这条路吗?谢谢您的点子。

推荐答案

是,您需要使用grid或覆盖样式。这是进入语义用户界面的唯一方法。 这在mobile only类定义中很明显。

@media only screen and (max-width: 991px) and (min-width: 768px) {
  .ui[class*="mobile only"].grid.grid.grid:not(.tablet),
  .ui.grid.grid.grid > [class*="mobile only"].row:not(.tablet),
  .ui.grid.grid.grid > [class*="mobile only"].column:not(.tablet),
  .ui.grid.grid.grid > .row > [class*="mobile only"].column:not(.tablet) {
    display: none !important;
  }
}

@media only screen and (max-width: 1199px) and (min-width: 992px) {
  .ui[class*="mobile only"].grid.grid.grid:not(.computer),
  .ui.grid.grid.grid > [class*="mobile only"].row:not(.computer),
  .ui.grid.grid.grid > [class*="mobile only"].column:not(.computer),
  .ui.grid.grid.grid > .row > [class*="mobile only"].column:not(.computer) {
    display: none !important;
  }
}

@media only screen and (max-width: 1919px) and (min-width: 1200px) {
  .ui[class*="mobile only"].grid.grid.grid:not(.computer),
  .ui.grid.grid.grid > [class*="mobile only"].row:not(.computer),
  .ui.grid.grid.grid > [class*="mobile only"].column:not(.computer),
  .ui.grid.grid.grid > .row > [class*="mobile only"].column:not(.computer) {
    display: none !important;
  }
}

@media only screen and (min-width: 1920px) {
  .ui[class*="mobile only"].grid.grid.grid:not(.computer),
  .ui.grid.grid.grid > [class*="mobile only"].row:not(.computer),
  .ui.grid.grid.grid > [class*="mobile only"].column:not(.computer),
  .ui.grid.grid.grid > .row > [class*="mobile only"].column:not(.computer) {
    display: none !important;
  }
}

希望这能有所帮助。

这篇关于语义-UI:如何仅在移动设备上隐藏元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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