Which one is the right one? Semantic UI: Responsive Visibility

China☆狼群 提交于 2019-11-30 10:41:39

问题


I am new with semantic-UI and i love with the framework. They have vast of helpful documentation though, and more so confusing thing.

How does the Responsive visibility work?

There are the [mobile only tablet only small monitor only large monitor only] for the container... and some of the code, i found that there was [computer only, device only] ? What are the difference? thank you.


回答1:


Updated to reflect current docs and version 2.4.2

Responsive Visibility works by hiding a certain element (usually a ui container, but can also be e.g. grid rows) on specific screen sizes. For example, <div class="ui container mobile only"> would only be shown when the screen is less than 768px wide.

The documentation for Grid has a Device Visibility section which demonstrates several possible visibility modifiers:

  1. Mobile (mobile only)
  2. Tablet (tablet only)
  3. Tablet and Mobile (tablet mobile only)
  4. Computer (computer only)
  5. Large screen (large screen only)
  6. Widescreen (widescreen only)
  7. All Sizes (no modifier)

The documentation doesn't explicitly mention what the device breakpoints are. Like most things, they can be configured via SASS variables when building Semantic UI and are defined inside site.variables. The default breakpoints are:

  1. mobile only will only display below 768px
  2. tablet only will only display between 768px - 991px
  3. computer only will always display 992px and above
  4. large screen only will only display between 1200px - 1919px
  5. widescreen only will only display 1920px and above

As seen in the documentation for Grid, it's possible to combine these as well - e.g. tablet mobile only and mobile computer only are perfectly valid.




回答2:


This can't display below 768px:

<div class="ui container mobile only">

The correct expression is below:

<div class="ui container mobile only grid">


来源:https://stackoverflow.com/questions/32172155/which-one-is-the-right-one-semantic-ui-responsive-visibility

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!