container.html 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. ---
  2. title: Container
  3. layout: documentation
  4. doc-tab: layout
  5. doc-subtab: container
  6. ---
  7. {% capture container_example %}
  8. <div class="container">
  9. <div class="notification">
  10. This container is <strong>centered</strong> on desktop.
  11. </div>
  12. </div>
  13. {% endcapture %}
  14. {% capture container_fluid_example %}
  15. <div class="container is-fluid">
  16. <div class="notification">
  17. This container is <strong>fluid</strong>: it will have a 24px gap on either side, on any viewport size.
  18. </div>
  19. </div>
  20. {% endcapture %}
  21. {% capture container_widescreen_example %}
  22. <div class="container is-widescreen">
  23. <div class="notification">
  24. This container is <strong>fullwidth</strong> <em>until</em> the <code>$widescreen</code> breakpoint.
  25. </div>
  26. </div>
  27. {% endcapture %}
  28. {% capture container_fullhd_example %}
  29. <div class="container is-fullhd">
  30. <div class="notification">
  31. This container is <strong>fullwidth</strong> <em>until</em> the <code>$fullhd</code> breakpoint.
  32. </div>
  33. </div>
  34. {% endcapture %}
  35. {% include subnav-layout.html %}
  36. <section class="section">
  37. <div class="container">
  38. <h1 class="title">Container</h1>
  39. <h2 class="subtitle">
  40. A simple <strong>container</strong> to center your content horizontally
  41. </h2>
  42. <hr>
  43. <div class="content">
  44. <p>The <code>.container</code> class can be used in any context, but mostly as a <strong>direct child</strong> of either:</p>
  45. <ul>
  46. <li><code>.nav</code></li>
  47. <li><code>.hero</code></li>
  48. <li><code>.section</code></li>
  49. <li><code>.footer</code></li>
  50. </ul>
  51. <p>This is how the container will behave:</p>
  52. <ul>
  53. <li>on <strong>mobile</strong> and <strong>tablet</strong> {% include bp/touch.html %}, it will have a margin of <strong>24px</strong> on each side.</li>
  54. <li>on <strong>desktop</strong> {% include bp/desktop.html %}, it will have a maximum width of <strong>960px</strong> and will be <strong>horizontally centered</strong>.</li>
  55. <li>on <strong>widescreen</strong> {% include bp/widescreen.html %}, it will have a maximum width of <strong>1152px</strong>.</li>
  56. <li>on <strong>fullhd</strong> {% include bp/fullhd.html %}, it will have a maximum width of <strong>1344px</strong>.</li>
  57. </ul>
  58. <p>
  59. The <code>$gap</code> variable has a default value of <code>24px</code> but can be modified.
  60. </p>
  61. <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>
  62. </div>
  63. </div>
  64. </section>
  65. <div class="example is-fullwidth">
  66. {{container_example}}
  67. </div>
  68. {% highlight html %}{{container_example}}{% endhighlight %}
  69. <section class="section">
  70. <div class="container">
  71. <h3 class="title">Fluid container</h3>
  72. <div class="content">
  73. <p>If you don't want to have a maximum width but want to keep the 24px margin on the left and right sides, add the <code>is-fluid</code> modifier:</p>
  74. </div>
  75. </div>
  76. </section>
  77. <div class="example is-fullwidth">
  78. {{container_fluid_example}}
  79. </div>
  80. {% highlight html %}{{container_fluid_example}}{% endhighlight %}
  81. <section class="section">
  82. <div class="container">
  83. <h3 class="title">Breakpoint containers</h3>
  84. <div class="content">
  85. <p>
  86. <span class="tag is-success">New!</span>
  87. <span class="tag is-info">0.4.4</span>
  88. </p>
  89. <p>
  90. With the two modifiers <code>.is-widescreen</code> and <code>.is-fullhd</code>, you can have a <em>fullwidth</em> container <strong>until</strong> those specific breakpoints.
  91. </p>
  92. </div>
  93. </div>
  94. </section>
  95. <div class="example is-fullwidth">
  96. {{container_widescreen_example}}
  97. </div>
  98. {% highlight html %}{{container_widescreen_example}}{% endhighlight %}
  99. <div class="example is-fullwidth">
  100. {{container_fullhd_example}}
  101. </div>
  102. {% highlight html %}{{container_fullhd_example}}{% endhighlight %}