responsiveness.html 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. ---
  2. title: Responsiveness
  3. subtitle: "Bulma is a <strong>mobile-first</strong> framework"
  4. layout: documentation
  5. doc-tab: overview
  6. doc-subtab: responsiveness
  7. breadcrumb:
  8. - home
  9. - documentation
  10. - overview
  11. - overview-responsiveness
  12. variables_keys:
  13. - gap
  14. - tablet
  15. - desktop
  16. - widescreen
  17. - fullhd
  18. ---
  19. {% capture scss_code %}
  20. // Disable the widescreen breakpoint
  21. $widescreen-enabled: false
  22. // Disable the fullhd breakpoint
  23. $fullhd-enabled: false
  24. {% endcapture %}
  25. {% include anchor.html name="Vertical by default" %}
  26. <div class="content">
  27. <p>
  28. Every element in Bulma is <strong>mobile-first</strong> and optimizes for <strong>vertical reading</strong>, so by default on mobile:
  29. </p>
  30. <ul>
  31. <li><code>columns</code> are stacked vertically</li>
  32. <li>the <code>level</code> component will show its children stacked vertically</li>
  33. <li>the <code>nav</code> menu will be hidden</li>
  34. </ul>
  35. <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>
  36. </div>
  37. {% include anchor.html name="Breakpoints" %}
  38. {% assign variables_file_url = "/blob/master/sass/utilities/initial-variables.sass#L46,L57" | prepend: site.data.meta.github %}
  39. {% assign mixins_file_url = "/blob/master/sass/utilities/mixins.sass#L182,L226" | prepend: site.data.meta.github %}
  40. <div class="content">
  41. <p>Bulma has <a href="{{ variables_file_url }}" target="_blank">5 breakpoints</a>:</p>
  42. <ul>
  43. {% for breakpoint_hash in site.data.breakpoints %}
  44. {% assign breakpoint = breakpoint_hash[1] %}
  45. <li><code>{{ breakpoint.id }}</code>: {% if breakpoint.id == 'mobile' %}up to <code>{{ breakpoint.to }}px</code>{% else %}from <code>{{ breakpoint.from }}px</code>{% endif %}</li>
  46. {% endfor %}
  47. </ul>
  48. <p>Bulma uses <a href="{{ mixins_file_url }}" target="_blank">9 responsive mixins</a>:</p>
  49. <ul>
  50. {% for breakpoint_hash in site.data.breakpoints %}
  51. {% assign breakpoint = breakpoint_hash[1] %}
  52. {% case breakpoint.id %}
  53. {% when 'mobile' %}
  54. <li>
  55. <code>={{ breakpoint.id }}</code><br>
  56. until <code>{{ breakpoint.to }}px</code>
  57. </li>
  58. {% when 'fullhd' %}
  59. <li>
  60. <code>={{ breakpoint.id }}</code><br>
  61. from <code>{{ breakpoint.from }}px</code>
  62. </li>
  63. {% else %}
  64. <li>
  65. <code>={{ breakpoint.id }}</code><br>
  66. from <code>{{ breakpoint.from }}px</code>
  67. </li>
  68. <li>
  69. <code>={{ breakpoint.id }}-only</code><br>
  70. from <code>{{ breakpoint.from }}px</code> and until <code>{{ breakpoint.to }}px</code>
  71. </li>
  72. {% if breakpoint.id == 'tablet' %}
  73. <li>
  74. <code>=touch</code><br>
  75. until <code>{{ breakpoint.to }}px</code>
  76. </li>
  77. {% endif %}
  78. {% endcase %}
  79. {% endfor %}
  80. </ul>
  81. </div>
  82. <table class="table is-bordered">
  83. <thead>
  84. <tr>
  85. {% for breakpoint_hash in site.data.breakpoints %}
  86. {% assign breakpoint = breakpoint_hash[1] %}
  87. <th style="width: 20%;">
  88. {{ breakpoint.name }}<br>
  89. {% if breakpoint.id == 'mobile' %}
  90. Up to <code>{{ breakpoint.to }}px</code>
  91. {% elsif breakpoint.id == 'fullhd' %}
  92. <code>{{ breakpoint.from }}px</code> and above
  93. {% else %}
  94. Between <code>{{ breakpoint.from }}px</code> and <code>{{ breakpoint.to }}px</code>
  95. {% endif %}
  96. </th>
  97. {% endfor %}
  98. </tr>
  99. </thead>
  100. <tbody>
  101. <tr>
  102. <td>
  103. <p class="notification is-success">mobile</p>
  104. </td>
  105. <td colspan="4">
  106. <p class="notification">-</p>
  107. </td>
  108. </tr>
  109. <tr>
  110. <td>
  111. <p class="notification">-</p>
  112. </td>
  113. <td colspan="4">
  114. <p class="notification is-success">tablet</p>
  115. </td>
  116. </tr>
  117. <tr>
  118. <td colspan="2">
  119. <p class="notification">-</p>
  120. </td>
  121. <td colspan="3">
  122. <p class="notification is-success">desktop</p>
  123. </td>
  124. </tr>
  125. <tr>
  126. <td colspan="3">
  127. <p class="notification">-</p>
  128. </td>
  129. <td colspan="2">
  130. <p class="notification is-success">widescreen</p>
  131. </td>
  132. </tr>
  133. <tr>
  134. <td colspan="4">
  135. <p class="notification">-</p>
  136. </td>
  137. <td>
  138. <p class="notification is-success">fullhd</p>
  139. </td>
  140. </tr>
  141. <tr>
  142. <td>
  143. <p class="notification">-</p>
  144. </td>
  145. <td>
  146. <p class="notification is-success">tablet-only</p>
  147. </td>
  148. <td colspan="3">
  149. <p class="notification">-</p>
  150. </td>
  151. </tr>
  152. <tr>
  153. <td colspan="2">
  154. <p class="notification">-</p>
  155. </td>
  156. <td>
  157. <p class="notification is-success">desktop-only</p>
  158. </td>
  159. <td colspan="2">
  160. <p class="notification">-</p>
  161. </td>
  162. </tr>
  163. <tr>
  164. <td colspan="3">
  165. <p class="notification">-</p>
  166. </td>
  167. <td>
  168. <p class="notification is-success">widescreen-only</p>
  169. </td>
  170. <td>
  171. <p class="notification">-</p>
  172. </td>
  173. </tr>
  174. <tr>
  175. <td colspan="2">
  176. <p class="notification is-success">touch</p>
  177. </td>
  178. <td colspan="3">
  179. <p class="notification">-</p>
  180. </td>
  181. </tr>
  182. <tr>
  183. <td colspan="3">
  184. <p class="notification is-success">until-widescreen</p>
  185. </td>
  186. <td colspan="2">
  187. <p class="notification">-</p>
  188. </td>
  189. </tr>
  190. <tr>
  191. <td colspan="4">
  192. <p class="notification is-success">until-fullhd</p>
  193. </td>
  194. <td colspan="1">
  195. <p class="notification">-</p>
  196. </td>
  197. </tr>
  198. </tbody>
  199. </table>
  200. {% include anchor.html name="Disabling breakpoints" %}
  201. {% include elements/new-tag.html version="0.6.3" %}
  202. <div class="content">
  203. <p>
  204. By default, the <code>$widecreen</code> and <code>$fullhd</code> breakpoints are <strong>enabled</strong>. You can disable them by setting the corresponding Sass boolean to <code>false</code>:
  205. </p>
  206. </div>
  207. <div class="highlight-full">
  208. {% highlight sass %}{{ scss_code }}{% endhighlight %}
  209. </div>
  210. {% include anchor.html name="Variables" %}
  211. <div class="content">
  212. <p>
  213. 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>.
  214. </p>
  215. </div>
  216. <table class="table is-bordered">
  217. <thead>
  218. <tr>
  219. <th>Name</th>
  220. <th>Default value</th>
  221. </tr>
  222. </thead>
  223. <tfoot>
  224. <tr>
  225. <th>Name</th>
  226. <th>Default value</th>
  227. </tr>
  228. </tfoot>
  229. <tbody>
  230. {% for key in page.variables_keys %}
  231. {% assign variable = site.data.variables.utilities.initial-variables.vars[key] %}
  232. <tr>
  233. <td>
  234. <code>{{ variable.name }}</code>
  235. </td>
  236. <td>
  237. <code>{{ variable.value }}</code>
  238. </td>
  239. </tr>
  240. {% endfor %}
  241. </tbody>
  242. </table>