responsiveness.html 6.5 KB

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