container.html 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. ---
  2. layout: documentation
  3. doc-tab: layout
  4. doc-subtab: container
  5. ---
  6. {% include subnav-layout.html %}
  7. <section class="section">
  8. <div class="container">
  9. <h1 class="title">Container</h1>
  10. <h2 class="subtitle">
  11. A simple <strong>container</strong> to center your content horizontally
  12. </h2>
  13. <hr>
  14. <div class="content">
  15. <p>The <code>.container</code> class can be used in any context, but mostly as a <strong>direct child</strong> of either:</p>
  16. <ul>
  17. <li><code>.nav</code></li>
  18. <li><code>.hero</code></li>
  19. <li><code>.section</code></li>
  20. <li><code>.footer</code></li>
  21. </ul>
  22. <p>This is how the container will behave:</p>
  23. <ul>
  24. <li>on <strong>mobile</strong> and <strong>tablet</strong>, it will have a margin of <strong>20px</strong> on both the left and right sides.</li>
  25. <li>on <strong>desktop</strong> (>= 1000px), it will have a maximum width of <strong>960px</strong> and will be <strong>horizontally centered</strong>.</li>
  26. <li>on <strong>widescreen</strong> (>= 1192px), it will have a maximum width of <strong>1152px</strong>.</li>
  27. <li>on <strong>fullhd</strong> (>= 1384px), it will have a maximum width of <strong>1344px</strong>.</li>
  28. </ul>
  29. <p>The values <strong>960</strong>, <strong>1152</strong> and <strong>1344</strong> have been chosen because they are divisible by both <strong>12</strong> and <strong>16</strong>.</p>
  30. </div>
  31. </div>
  32. </section>
  33. <div class="example is-fullwidth">
  34. <div class="container">
  35. <div class="notification">
  36. This container is <strong>centered</strong> on desktop.
  37. </div>
  38. </div>
  39. </div>
  40. {% highlight html %}
  41. <div class="container">
  42. <div class="notification">
  43. This container is <strong>centered</strong> on desktop.
  44. </div>
  45. </div>
  46. {% endhighlight %}
  47. <div class="container">
  48. <hr>
  49. <h3 class="title">Fluid container</h3>
  50. <div class="content">
  51. <p>If you don't want to have a maximum width but want to keep the 20px margin on the left and right sides, add the <code>is-fluid</code> modifier:</p>
  52. </div>
  53. </div>
  54. <div class="example is-fullwidth">
  55. <div class="container is-fluid">
  56. <div class="notification">
  57. This container is <strong>fluid</strong>: it will have a 20px gap on either side.
  58. </div>
  59. </div>
  60. </div>
  61. {% highlight html %}
  62. <div class="container is-fluid">
  63. <div class="notification">
  64. This container is <strong>fluid</strong>: it will have a 20px gap on either side, on any viewport size.
  65. </div>
  66. </div>
  67. {% endhighlight %}