container.html 3.8 KB

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