responsive-helpers.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. ---
  2. title: Responsive helpers
  3. subtitle: "<strong>Show/hide content</strong> depending on the width of the viewport"
  4. layout: documentation
  5. doc-tab: modifiers
  6. doc-subtab: responsive-helpers
  7. breadcrumb:
  8. - home
  9. - documentation
  10. - modifiers
  11. - modifiers-responsive-helpers
  12. ---
  13. {% capture thead %}
  14. <thead>
  15. <tr>
  16. <th>
  17. Class
  18. </th>
  19. {% for breakpoint_hash in site.data.breakpoints %}
  20. {% assign breakpoint = breakpoint_hash[1] %}
  21. <th>
  22. {{ breakpoint.name }}<br>
  23. {% if breakpoint.id == 'mobile' %}
  24. Up to <code>{{ breakpoint.to }}px</code>
  25. {% elsif breakpoint.id == 'fullhd' %}
  26. <code>{{ breakpoint.from }}px</code> and above
  27. {% else %}
  28. Between <code>{{ breakpoint.from }}px</code> and <code>{{ breakpoint.to }}px</code>
  29. {% endif %}
  30. </th>
  31. {% endfor %}
  32. </tr>
  33. </thead>
  34. {% endcapture %}
  35. {% capture flex %}
  36. <td class="is-narrow">
  37. <p class="notification is-success">flex</p>
  38. </td>
  39. {% endcapture %}
  40. {% capture visible %}
  41. <td class="is-narrow">
  42. <p class="notification is-success">visible</p>
  43. </td>
  44. {% endcapture %}
  45. {% capture hidden %}
  46. <td class="is-narrow">
  47. <p class="notification">hidden</p>
  48. </td>
  49. {% endcapture %}
  50. {% capture unchanged %}
  51. <td class="is-narrow">
  52. <p class="notification">unchanged</p>
  53. </td>
  54. {% endcapture %}
  55. {% include anchor.html name="Show" %}
  56. <div class="content">
  57. <p>
  58. You can use one of the following <code>display</code> classes:
  59. </p>
  60. <ul>
  61. <li><code>block</code></li>
  62. <li><code>flex</code></li>
  63. <li><code>inline</code></li>
  64. <li><code>inline-block</code></li>
  65. <li><code>inline-flex</code></li>
  66. </ul>
  67. <p>For example, here's how the <code>is-flex</code> helper works:</p>
  68. </div>
  69. <table class="table is-bordered">
  70. {{ thead }}
  71. <tbody>
  72. <tr>
  73. <td class="is-narrow">
  74. <code>is-flex-mobile</code>
  75. </td>
  76. {{ flex }}
  77. {{ unchanged }}
  78. {{ unchanged }}
  79. {{ unchanged }}
  80. {{ unchanged }}
  81. </tr>
  82. <tr>
  83. <td class="is-narrow">
  84. <code>is-flex-tablet-only</code>
  85. </td>
  86. {{ unchanged }}
  87. {{ flex }}
  88. {{ unchanged }}
  89. {{ unchanged }}
  90. {{ unchanged }}
  91. </tr>
  92. <tr>
  93. <td class="is-narrow">
  94. <code>is-flex-desktop-only</code>
  95. </td>
  96. {{ unchanged }}
  97. {{ unchanged }}
  98. {{ flex }}
  99. {{ unchanged }}
  100. {{ unchanged }}
  101. </tr>
  102. <tr>
  103. <td class="is-narrow">
  104. <code>is-flex-widescreen-only</code>
  105. </td>
  106. {{ unchanged }}
  107. {{ unchanged }}
  108. {{ unchanged }}
  109. {{ flex }}
  110. {{ unchanged }}
  111. </tr>
  112. <tr>
  113. <th colspan="5">
  114. <p>Classes to display <strong>up to</strong> or <strong>from</strong> a specific breakpoint</p>
  115. </th>
  116. </tr>
  117. <tr>
  118. <td class="is-narrow">
  119. <code>is-flex-touch</code>
  120. </td>
  121. {{ flex }}
  122. {{ flex }}
  123. {{ unchanged }}
  124. {{ unchanged }}
  125. {{ unchanged }}
  126. </tr>
  127. <tr>
  128. <td class="is-narrow">
  129. <code>is-flex-tablet</code>
  130. </td>
  131. {{ unchanged }}
  132. {{ flex }}
  133. {{ flex }}
  134. {{ flex }}
  135. {{ flex }}
  136. </tr>
  137. <tr>
  138. <td class="is-narrow">
  139. <code>is-flex-desktop</code>
  140. </td>
  141. {{ unchanged }}
  142. {{ unchanged }}
  143. {{ flex }}
  144. {{ flex }}
  145. {{ flex }}
  146. </tr>
  147. <tr>
  148. <td class="is-narrow">
  149. <code>is-flex-widescreen</code>
  150. </td>
  151. {{ unchanged }}
  152. {{ unchanged }}
  153. {{ unchanged }}
  154. {{ flex }}
  155. {{ flex }}
  156. </tr>
  157. <tr>
  158. <td class="is-narrow">
  159. <code>is-flex-fullhd</code>
  160. </td>
  161. {{ unchanged }}
  162. {{ unchanged }}
  163. {{ unchanged }}
  164. {{ unchanged }}
  165. {{ flex }}
  166. </tr>
  167. </tbody>
  168. </table>
  169. <div class="content">
  170. <p>
  171. For the other display options, just replace <code>is-flex</code> with <code>is-block</code> <code>is-inline</code> <code>is-inline-block</code> or <code>is-inline-flex</code>
  172. </p>
  173. </div>
  174. {% include anchor.html name="Hide" %}
  175. <table class="table is-bordered">
  176. {{ thead }}
  177. <tbody>
  178. <tr>
  179. <td class="is-narrow">
  180. <code>is-hidden-mobile</code>
  181. </td>
  182. {{ hidden }}
  183. {{ visible }}
  184. {{ visible }}
  185. {{ visible }}
  186. {{ visible }}
  187. </tr>
  188. <tr>
  189. <td class="is-narrow">
  190. <code>is-hidden-tablet-only</code>
  191. </td>
  192. {{ visible }}
  193. {{ hidden }}
  194. {{ visible }}
  195. {{ visible }}
  196. {{ visible }}
  197. </tr>
  198. <tr>
  199. <td class="is-narrow">
  200. <code>is-hidden-desktop-only</code>
  201. </td>
  202. {{ visible }}
  203. {{ visible }}
  204. {{ hidden }}
  205. {{ visible }}
  206. {{ visible }}
  207. </tr>
  208. <tr>
  209. <td class="is-narrow">
  210. <code>is-hidden-widescreen-only</code>
  211. </td>
  212. {{ visible }}
  213. {{ visible }}
  214. {{ visible }}
  215. {{ hidden }}
  216. {{ visible }}
  217. </tr>
  218. <tr>
  219. <th colspan="5">
  220. <p>Classes to hide <strong>up to</strong> or <strong>from</strong> a specific breakpoint</p>
  221. </th>
  222. </tr>
  223. <tr>
  224. <td class="is-narrow">
  225. <code>is-hidden-touch</code>
  226. </td>
  227. {{ hidden }}
  228. {{ hidden }}
  229. {{ visible }}
  230. {{ visible }}
  231. {{ visible }}
  232. </tr>
  233. <tr>
  234. <td class="is-narrow">
  235. <code>is-hidden-tablet</code>
  236. </td>
  237. {{ visible }}
  238. {{ hidden }}
  239. {{ hidden }}
  240. {{ hidden }}
  241. {{ hidden }}
  242. </tr>
  243. <tr>
  244. <td class="is-narrow">
  245. <code>is-hidden-desktop</code>
  246. </td>
  247. {{ visible }}
  248. {{ visible }}
  249. {{ hidden }}
  250. {{ hidden }}
  251. {{ hidden }}
  252. </tr>
  253. <tr>
  254. <td class="is-narrow">
  255. <code>is-hidden-widescreen</code>
  256. </td>
  257. {{ visible }}
  258. {{ visible }}
  259. {{ visible }}
  260. {{ hidden }}
  261. {{ hidden }}
  262. </tr>
  263. <tr>
  264. <td class="is-narrow">
  265. <code>is-hidden-fullhd</code>
  266. </td>
  267. {{ visible }}
  268. {{ visible }}
  269. {{ visible }}
  270. {{ visible }}
  271. {{ hidden }}
  272. </tr>
  273. </tbody>
  274. </table>