responsiveness.html 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  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. <table class="table is-bordered">
  200. <thead>
  201. <tr>
  202. {% for breakpoint_hash in site.data.breakpoints %}
  203. {% assign breakpoint = breakpoint_hash[1] %}
  204. <th style="width: 20%;">
  205. {{ breakpoint.name }}<br>
  206. {% if breakpoint.id == 'mobile' %}
  207. Up to <code>{{ breakpoint.to }}px</code>
  208. {% elsif breakpoint.id == 'fullhd' %}
  209. <code>{{ breakpoint.from }}px</code> and above
  210. {% else %}
  211. Between <code>{{ breakpoint.from }}px</code> and <code>{{ breakpoint.to }}px</code>
  212. {% endif %}
  213. </th>
  214. {% endfor %}
  215. </tr>
  216. </thead>
  217. <tbody>
  218. <tr>
  219. <td>
  220. <p class="notification is-success">mobile</p>
  221. </td>
  222. <td colspan="4">
  223. <p class="notification">-</p>
  224. </td>
  225. </tr>
  226. <tr>
  227. <td>
  228. <p class="notification">-</p>
  229. </td>
  230. <td colspan="4">
  231. <p class="notification is-success">tablet</p>
  232. </td>
  233. </tr>
  234. <tr>
  235. <td colspan="2">
  236. <p class="notification">-</p>
  237. </td>
  238. <td colspan="3">
  239. <p class="notification is-success">desktop</p>
  240. </td>
  241. </tr>
  242. <tr>
  243. <td colspan="3">
  244. <p class="notification">-</p>
  245. </td>
  246. <td colspan="2">
  247. <p class="notification is-success">widescreen</p>
  248. </td>
  249. </tr>
  250. <tr>
  251. <td colspan="4">
  252. <p class="notification">-</p>
  253. </td>
  254. <td>
  255. <p class="notification is-success">fullhd</p>
  256. </td>
  257. </tr>
  258. <tr>
  259. <td>
  260. <p class="notification">-</p>
  261. </td>
  262. <td>
  263. <p class="notification is-success">tablet-only</p>
  264. </td>
  265. <td colspan="3">
  266. <p class="notification">-</p>
  267. </td>
  268. </tr>
  269. <tr>
  270. <td colspan="2">
  271. <p class="notification">-</p>
  272. </td>
  273. <td>
  274. <p class="notification is-success">desktop-only</p>
  275. </td>
  276. <td colspan="2">
  277. <p class="notification">-</p>
  278. </td>
  279. </tr>
  280. <tr>
  281. <td colspan="3">
  282. <p class="notification">-</p>
  283. </td>
  284. <td>
  285. <p class="notification is-success">widescreen-only</p>
  286. </td>
  287. <td>
  288. <p class="notification">-</p>
  289. </td>
  290. </tr>
  291. <tr>
  292. <td colspan="2">
  293. <p class="notification is-success">touch</p>
  294. </td>
  295. <td colspan="3">
  296. <p class="notification">-</p>
  297. </td>
  298. </tr>
  299. <tr>
  300. <td colspan="3">
  301. <p class="notification is-success">until-widescreen</p>
  302. </td>
  303. <td colspan="2">
  304. <p class="notification">-</p>
  305. </td>
  306. </tr>
  307. <tr>
  308. <td colspan="4">
  309. <p class="notification is-success">until-fullhd</p>
  310. </td>
  311. <td colspan="1">
  312. <p class="notification">-</p>
  313. </td>
  314. </tr>
  315. </tbody>
  316. </table>
  317. {% assign vernum = site.version | downcase | remove: "." | plus: 0 %}
  318. {% if vernum >= 70 %}
  319. {% include elements/anchor.html name="Disabling breakpoints" %}
  320. {% include elements/new-tag.html version="0.7.0" %}
  321. <div class="content">
  322. <p>
  323. 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>:
  324. </p>
  325. </div>
  326. <div class="highlight-full">
  327. {% highlight sass %}{{ scss_code }}{% endhighlight %}
  328. </div>
  329. {% endif %}
  330. {% include elements/anchor.html name="Variables" %}
  331. <div class="content">
  332. <p>
  333. 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>.
  334. </p>
  335. </div>
  336. <table class="table is-bordered">
  337. <thead>
  338. <tr>
  339. <th>Name</th>
  340. <th>Default value</th>
  341. </tr>
  342. </thead>
  343. <tfoot>
  344. <tr>
  345. <th>Name</th>
  346. <th>Default value</th>
  347. </tr>
  348. </tfoot>
  349. <tbody>
  350. {% for key in page.variables_keys %}
  351. {% assign variable = site.data.variables.utilities.initial-variables.vars[key] %}
  352. <tr>
  353. <td>
  354. <code>{{ variable.name }}</code>
  355. </td>
  356. <td>
  357. <code>{{ variable.value }}</code>
  358. </td>
  359. </tr>
  360. {% endfor %}
  361. </tbody>
  362. </table>