container.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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>.navbar</code></li>
  47. <li><code>.hero</code></li>
  48. <li><code>.section</code></li>
  49. <li><code>.footer</code></li>
  50. </ul>
  51. <p>
  52. The container <strong>breakpoints</strong> have an <strong>offset</strong> defined by the <code>$container-offset</code> variable. It has a default value of <code>60px</code>.
  53. </p>
  54. <p>This is how the container will behave:</p>
  55. <ul>
  56. <li>on <code>$desktop</code> + <code>$container-offset</code> = <code>>= 1068px</code> it will have a maximum width of <strong>960px</strong> and will be <strong>horizontally centered</strong>.</li>
  57. <li>on <code>$widescreen</code> + <code>$container-offset</code> = <code>>= 1260px</code> it will have a maximum width of <strong>1152px</strong>.</li>
  58. <li>on <code>$fullhd</code> + <code>$container-offset</code> = <code>>= 1452px</code> it will have a maximum width of <strong>1344px</strong>.</li>
  59. </ul>
  60. <p>
  61. The <code>$gap</code> variable has a default value of <code>24px</code> but can be modified.
  62. </p>
  63. <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>
  64. </div>
  65. </div>
  66. </section>
  67. <div class="bd-example is-fullwidth">
  68. {{container_example}}
  69. </div>
  70. {% highlight html %}{{container_example}}{% endhighlight %}
  71. <section class="section">
  72. <div class="container">
  73. <h3 class="title is-4">Fluid container</h3>
  74. <div class="content">
  75. <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>
  76. </div>
  77. </div>
  78. </section>
  79. <div class="bd-example is-fullwidth">
  80. {{container_fluid_example}}
  81. </div>
  82. {% highlight html %}{{container_fluid_example}}{% endhighlight %}
  83. <section class="section">
  84. <div class="container">
  85. <h3 class="title is-4">Breakpoint containers</h3>
  86. <div class="content">
  87. <p>
  88. <span class="tag is-success">New!</span>
  89. <span class="tag is-info">0.4.4</span>
  90. </p>
  91. <p>
  92. 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.
  93. </p>
  94. </div>
  95. </div>
  96. </section>
  97. <div class="bd-example is-fullwidth">
  98. {{container_widescreen_example}}
  99. </div>
  100. {% highlight html %}{{container_widescreen_example}}{% endhighlight %}
  101. <div class="bd-example is-fullwidth">
  102. {{container_fullhd_example}}
  103. </div>
  104. {% highlight html %}{{container_fullhd_example}}{% endhighlight %}