container.html 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. ---
  2. title: Container
  3. layout: documentation
  4. hide_carbon: true
  5. doc-tab: layout
  6. doc-subtab: container
  7. breadcrumb:
  8. - home
  9. - documentation
  10. - layout
  11. - layout-container
  12. ---
  13. {% capture container_example %}
  14. <div class="container">
  15. <div class="notification">
  16. This container is <strong>centered</strong> on desktop.
  17. </div>
  18. </div>
  19. {% endcapture %}
  20. {% capture container_fluid_example %}
  21. <div class="container is-fluid">
  22. <div class="notification">
  23. This container is <strong>fluid</strong>: it will have a 32px gap on either side, on any
  24. viewport size.
  25. </div>
  26. </div>
  27. {% endcapture %}
  28. {% capture container_widescreen_example %}
  29. <div class="container is-widescreen">
  30. <div class="notification">
  31. This container is <strong>fullwidth</strong> <em>until</em> the <code>$widescreen</code> breakpoint.
  32. </div>
  33. </div>
  34. {% endcapture %}
  35. {% capture container_fullhd_example %}
  36. <div class="container is-fullhd">
  37. <div class="notification">
  38. This container is <strong>fullwidth</strong> <em>until</em> the <code>$fullhd</code> breakpoint.
  39. </div>
  40. </div>
  41. {% endcapture %}
  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>.navbar</code></li>
  46. <li><code>.hero</code></li>
  47. <li><code>.section</code></li>
  48. <li><code>.footer</code></li>
  49. </ul>
  50. <p>
  51. The containers <strong>width</strong> for each <strong>breakpoint</strong> is the result
  52. of: <code>$device - (2 * $gap)</code>. The <code>$gap</code> variable has a default value of <code>
  53. 32px</code> but can be modified.
  54. </p>
  55. <p>This is how the container will behave:</p>
  56. <ul>
  57. <li>on <code>$desktop</code> it will have a maximum width of <strong>960px</strong>.</li>
  58. <li>on <code>$widescreen</code> it will have a maximum width of <strong>1152px</strong>.</li>
  59. <li>on <code>$fullhd</code> it will have a maximum width of <strong>1344px</strong>.</li>
  60. </ul>
  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. {% include layout/main-close.html %}
  64. <div class="bd-example is-fullwidth">
  65. {{container_example}}
  66. </div>
  67. {% include layout/main-open.html %}
  68. {% highlight html %}{{ container_example }}{% endhighlight %}
  69. <h3 class="title is-4">Fluid container</h3>
  70. <div class="content">
  71. <p>If you don't want to have a maximum width but want to keep the 32px margin on the left and
  72. right sides, add the <code>is-fluid</code> modifier:</p>
  73. </div>
  74. {% include layout/main-close.html %}
  75. <div class="bd-example is-fullwidth">
  76. {{container_fluid_example}}
  77. </div>
  78. {% include layout/main-open.html %}
  79. {% highlight html %}{{ container_fluid_example }}{% endhighlight %}
  80. <h3 class="title is-4">Breakpoint containers</h3>
  81. <div class="content">
  82. <p>
  83. 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.
  84. </p>
  85. </div>
  86. {% include layout/main-close.html %}
  87. <div class="bd-example is-fullwidth">
  88. {{container_widescreen_example}}
  89. </div>
  90. {% include layout/main-open.html %}
  91. {% highlight html %}{{ container_widescreen_example }}{% endhighlight %}
  92. {% include layout/main-close.html %}
  93. <div class="bd-example is-fullwidth">
  94. {{ container_fullhd_example }}
  95. </div>
  96. {% include layout/main-open.html %}
  97. {% highlight html %}{{ container_fullhd_example }}{% endhighlight %}