responsive-helpers.html 6.9 KB

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