responsiveness.html 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. ---
  2. title: Responsiveness
  3. layout: documentation
  4. doc-tab: overview
  5. doc-subtab: responsiveness
  6. breadcrumb:
  7. - home
  8. - documentation
  9. - overview
  10. - overview-responsiveness
  11. variables_keys:
  12. - $gap
  13. - $tablet
  14. - $desktop
  15. - $widescreen
  16. - $fullhd
  17. ---
  18. {% capture scss_code %}
  19. // Disable the widescreen breakpoint
  20. $widescreen-enabled: false
  21. // Disable the fullhd breakpoint
  22. $fullhd-enabled: false
  23. {% endcapture %}
  24. {% include elements/anchor.html name="Vertical by default" %}
  25. <div class="content">
  26. <p>
  27. Every element in Bulma is <strong>mobile-first</strong> and optimizes for <strong>vertical reading</strong>, so by default on mobile:
  28. </p>
  29. <ul>
  30. <li><code>columns</code> are stacked vertically</li>
  31. <li>the <code>level</code> component will show its children stacked vertically</li>
  32. <li>the <code>nav</code> menu will be hidden</li>
  33. </ul>
  34. <p>You can however enforce the <strong>horizontal</strong> layout for both <code>columns</code> or <code>nav</code> by appending the <code>is-mobile</code> modifier.</p>
  35. </div>
  36. {% include elements/anchor.html name="Breakpoints" %}
  37. {% assign variables_file_url = "/blob/master/sass/utilities/initial-variables.sass#L46,L57" | prepend: site.data.meta.github %}
  38. {% assign mixins_file_url = "/blob/master/sass/utilities/mixins.sass#L81,L129" | prepend: site.data.meta.github %}
  39. <div class="content">
  40. <p>Bulma has <a href="{{ variables_file_url }}" target="_blank">5 breakpoints</a>:</p>
  41. <ul>
  42. {% for breakpoint_hash in site.data.breakpoints %}
  43. {% assign breakpoint = breakpoint_hash[1] %}
  44. <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>
  45. {% endfor %}
  46. </ul>
  47. <p>Bulma uses <a href="{{ mixins_file_url }}" target="_blank">9 responsive mixins</a>:</p>
  48. <ul>
  49. {% for breakpoint_hash in site.data.breakpoints %}
  50. {% assign breakpoint = breakpoint_hash[1] %}
  51. {% case breakpoint.id %}
  52. {% when 'mobile' %}
  53. <li>
  54. <code>={{ breakpoint.id }}</code><br>
  55. until <code>{{ breakpoint.to }}px</code>
  56. </li>
  57. {% when 'fullhd' %}
  58. <li>
  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. <tr>
  182. <td colspan="3">
  183. <p class="notification is-success">until-widescreen</p>
  184. </td>
  185. <td colspan="2">
  186. <p class="notification">-</p>
  187. </td>
  188. </tr>
  189. <tr>
  190. <td colspan="4">
  191. <p class="notification is-success">until-fullhd</p>
  192. </td>
  193. <td colspan="1">
  194. <p class="notification">-</p>
  195. </td>
  196. </tr>
  197. </tbody>
  198. </table>
  199. {% assign vernum = site.data.meta.version | downcase | remove: "." | plus: 0 %}
  200. {% if vernum >= 70 %}
  201. {% include elements/anchor.html name="Disabling breakpoints" %}
  202. {% include elements/new-tag.html version="0.7.0" %}
  203. <div class="content">
  204. <p>
  205. By default, the <code>$widescreen</code> and <code>$fullhd</code> breakpoints are <strong>enabled</strong>. You can disable them by setting the corresponding Sass boolean to <code>false</code>:
  206. </p>
  207. </div>
  208. <div class="highlight-full">
  209. {% highlight sass %}{{ scss_code }}{% endhighlight %}
  210. </div>
  211. {% endif %}
  212. {% capture custom_message %}
  213. These are <a href="{{ derived_variables.file_url }}" target="_blank">variables</a> with a value that <strong>references</strong> another variable.
  214. {% endcapture %}
  215. {% include elements/variables.html
  216. type='element'
  217. variables_keys=page.variables_keys
  218. custom_message=custom_message
  219. folder='utilities'
  220. file='initial-variables'
  221. %}