responsiveness.html 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. ---
  2. title: Responsiveness
  3. layout: documentation
  4. doc-tab: overview
  5. doc-subtab: responsiveness
  6. variables_keys:
  7. - gap
  8. - tablet
  9. - desktop
  10. - widescreen
  11. - fullhd
  12. ---
  13. {% include subnav-overview.html %}
  14. <section class="section">
  15. <div class="container">
  16. <h1 class="title">Responsiveness</h1>
  17. <h2 class="subtitle">Bulma is a <strong>mobile-first</strong> framework</h2>
  18. {% include anchor.html name="Vertical by default" %}
  19. <div class="content">
  20. <p>
  21. Every element in Bulma is <strong>mobile-first</strong> and optimizes for <strong>vertical reading</strong>, so by default on mobile:
  22. </p>
  23. <ul>
  24. <li><code>columns</code> are stacked vertically</li>
  25. <li>the <code>level</code> component will show its children stacked vertically</li>
  26. <li>the <code>nav</code> menu will be hidden</li>
  27. </ul>
  28. <p>For example, you can enforce the <strong>horizontal</strong> layout for both <code>columns</code> or <code>nav</code> by appending the <code>is-mobile</code> modifier.</p>
  29. </div>
  30. {% include anchor.html name="Breakpoints" %}
  31. {% assign variables_file_url = "/blob/master/sass/utilities/initial-variables.sass#L46,L57" | prepend: site.github %}
  32. {% assign mixins_file_url = "/blob/master/sass/utilities/mixins.sass#L182,L226" | prepend: site.github %}
  33. <div class="content">
  34. <p>Bulma has <a href="{{ variables_file_url }}" target="_blank">5 breakpoints</a>:</p>
  35. <ul>
  36. {% for breakpoint_hash in site.data.breakpoints %}
  37. {% assign breakpoint = breakpoint_hash[1] %}
  38. <li>{% if breakpoint.id == 'fullhd' %}<span class="tag is-success">New!</span> {% endif %}<code>{{ breakpoint.id }}</code>: {% if breakpoint.id == 'mobile' %}up to <code>{{ breakpoint.to }}px</code>{% else %}from <code>{{ breakpoint.from }}px</code>{% endif %}</li>
  39. {% endfor %}
  40. </ul>
  41. <p>Bulma uses <a href="{{ mixins_file_url }}" target="_blank">9 responsive mixins</a>:</p>
  42. <ul>
  43. {% for breakpoint_hash in site.data.breakpoints %}
  44. {% assign breakpoint = breakpoint_hash[1] %}
  45. {% case breakpoint.id %}
  46. {% when 'mobile' %}
  47. <li>
  48. <code>={{ breakpoint.id }}</code><br>
  49. until <code>{{ breakpoint.to }}px</code>
  50. </li>
  51. {% when 'fullhd' %}
  52. <li>
  53. <span class="tag is-success">New!</span>
  54. <code>={{ breakpoint.id }}</code><br>
  55. from <code>{{ breakpoint.from }}px</code>
  56. </li>
  57. {% else %}
  58. <li>
  59. <code>={{ breakpoint.id }}</code><br>
  60. from <code>{{ breakpoint.from }}px</code>
  61. </li>
  62. <li>
  63. <code>={{ breakpoint.id }}-only</code><br>
  64. from <code>{{ breakpoint.from }}px</code> and until <code>{{ breakpoint.to }}px</code>
  65. </li>
  66. {% if breakpoint.id == 'tablet' %}
  67. <li>
  68. <code>=touch</code><br>
  69. until <code>{{ breakpoint.to }}px</code>
  70. </li>
  71. {% endif %}
  72. {% endcase %}
  73. {% endfor %}
  74. </ul>
  75. </div>
  76. <table class="table is-bordered">
  77. <thead>
  78. <tr>
  79. {% for breakpoint_hash in site.data.breakpoints %}
  80. {% assign breakpoint = breakpoint_hash[1] %}
  81. <th style="width: 20%;">
  82. {{ breakpoint.name }}<br>
  83. {% if breakpoint.id == 'mobile' %}
  84. Up to <code>{{ breakpoint.to }}px</code>
  85. {% elsif breakpoint.id == 'fullhd' %}
  86. <code>{{ breakpoint.from }}px</code> and above
  87. {% else %}
  88. Between <code>{{ breakpoint.from }}px</code> and <code>{{ breakpoint.to }}px</code>
  89. {% endif %}
  90. </th>
  91. {% endfor %}
  92. </tr>
  93. </thead>
  94. <tbody>
  95. <tr>
  96. <td>
  97. <p class="notification is-success">mobile</p>
  98. </td>
  99. <td colspan="4">
  100. <p class="notification">-</p>
  101. </td>
  102. </tr>
  103. <tr>
  104. <td>
  105. <p class="notification">-</p>
  106. </td>
  107. <td colspan="4">
  108. <p class="notification is-success">tablet</p>
  109. </td>
  110. </tr>
  111. <tr>
  112. <td colspan="2">
  113. <p class="notification">-</p>
  114. </td>
  115. <td colspan="3">
  116. <p class="notification is-success">desktop</p>
  117. </td>
  118. </tr>
  119. <tr>
  120. <td colspan="3">
  121. <p class="notification">-</p>
  122. </td>
  123. <td colspan="2">
  124. <p class="notification is-success">widescreen</p>
  125. </td>
  126. </tr>
  127. <tr>
  128. <td colspan="4">
  129. <p class="notification">-</p>
  130. </td>
  131. <td>
  132. <p class="notification is-success">fullhd</p>
  133. </td>
  134. </tr>
  135. <tr>
  136. <td>
  137. <p class="notification">-</p>
  138. </td>
  139. <td>
  140. <p class="notification is-success">tablet-only</p>
  141. </td>
  142. <td colspan="3">
  143. <p class="notification">-</p>
  144. </td>
  145. </tr>
  146. <tr>
  147. <td colspan="2">
  148. <p class="notification">-</p>
  149. </td>
  150. <td>
  151. <p class="notification is-success">desktop-only</p>
  152. </td>
  153. <td colspan="2">
  154. <p class="notification">-</p>
  155. </td>
  156. </tr>
  157. <tr>
  158. <td colspan="3">
  159. <p class="notification">-</p>
  160. </td>
  161. <td>
  162. <p class="notification is-success">widescreen-only</p>
  163. </td>
  164. <td>
  165. <p class="notification">-</p>
  166. </td>
  167. </tr>
  168. <tr>
  169. <td colspan="2">
  170. <p class="notification is-success">touch</p>
  171. </td>
  172. <td colspan="3">
  173. <p class="notification">-</p>
  174. </td>
  175. </tr>
  176. </tbody>
  177. </table>
  178. {% include anchor.html name="Variables" %}
  179. <div class="content">
  180. <p>
  181. You can use <a href="{{ variables_file_url }}" target="_blank">these variables</a> to <strong>customize</strong> the responsive breakpoints. Simply set one or multiple of these variables <em>before</em> importing Bulma. <a href="{{ site.url }}/documentation/overview/customize/">Learn how</a>.
  182. </p>
  183. </div>
  184. <table class="table is-bordered">
  185. <thead>
  186. <tr>
  187. <th>Name</th>
  188. <th>Default value</th>
  189. </tr>
  190. </thead>
  191. <tfoot>
  192. <tr>
  193. <th>Name</th>
  194. <th>Default value</th>
  195. </tr>
  196. </tfoot>
  197. <tbody>
  198. {% for key in page.variables_keys %}
  199. {% assign variable = site.data.variables.utilities.initial-variables.vars[key] %}
  200. <tr>
  201. <td>
  202. <code>{{ variable.name }}</code>
  203. </td>
  204. <td>
  205. <code>{{ variable.value }}</code>
  206. </td>
  207. </tr>
  208. {% endfor %}
  209. </tbody>
  210. </table>
  211. </div>
  212. </section>