Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which are the correct classes for responsive visibility in Semantic-UI?

Tags:

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 onlylarge 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.

like image 310
postsrc Avatar asked Aug 23 '15 22:08

postsrc


People also ask

Is Semantic UI responsive?

Responsive Visibility Since variations in Semantic UI are only assigned in the scope of components, there are no "free floating" responsive class names, however some components include responsive variations to help ease responsive design.

Is Semantic UI Mobile responsive?

Semantic-UI Responsive Grid Stackable is used to stack the grid element in mobile or small screen devices. It will automatically stack all rows to a single column. Semantic-UI Responsive Grid Stackable Class: stackable: This class is used to automatically stack all the grid elements on a mobile devices.

How do you center in semantic UI?

To change the text alignment of the semantic UI card, we use the “center/left/right aligned” class in the section of the card where we want the alignment.

What is the use of semantic UI?

Semantic UI is a front-end development framework similar to bootstrap designed for theming. It contains pre-built semantic components that helps create beautiful and responsive layouts using human-friendly HTML.


2 Answers

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.

like image 86
fstanis Avatar answered Sep 20 '22 15:09

fstanis


This can't display below 768px:

<div class="ui container mobile only"> 

The correct expression is below:

<div class="ui container mobile only grid"> 
like image 33
Keyo Avatar answered Sep 19 '22 15:09

Keyo