| commit | author | age | ||
| 83c3f6 | 1 | --- |
| SP | 2 | layout: docs |
| 3 | title: Flex | |
| 4 | description: Quickly manage the layout, alignment, and sizing of grid columns, navigation, components, and more with a full suite of responsive flexbox utilities. For more complex implementations, custom CSS may be necessary. | |
| 5 | group: utilities | |
| 6 | toc: true | |
| 7 | --- | |
| 8 | ||
| 9 | ## Enable flex behaviors | |
| 10 | ||
| 11 | Apply `display` utilities to create a flexbox container and transform **direct children elements** into flex items. Flex containers and items are able to be modified further with additional flex properties. | |
| 12 | ||
| 13 | {% capture example %} | |
| 14 | <div class="d-flex p-2 bd-highlight">I'm a flexbox container!</div> | |
| 15 | {% endcapture %} | |
| 16 | {% include example.html content=example %} | |
| 17 | ||
| 18 | {% capture example %} | |
| 19 | <div class="d-inline-flex p-2 bd-highlight">I'm an inline flexbox container!</div> | |
| 20 | {% endcapture %} | |
| 21 | {% include example.html content=example %} | |
| 22 | ||
| 23 | Responsive variations also exist for `.d-flex` and `.d-inline-flex`. | |
| 24 | ||
| 25 | {% for bp in site.data.breakpoints %} | |
| 26 | - `.d{{ bp.abbr }}-flex` | |
| 27 | - `.d{{ bp.abbr }}-inline-flex`{% endfor %} | |
| 28 | ||
| 29 | ## Direction | |
| 30 | ||
| 31 | Set the direction of flex items in a flex container with direction utilities. In most cases you can omit the horizontal class here as the browser default is `row`. However, you may encounter situations where you needed to explicitly set this value (like responsive layouts). | |
| 32 | ||
| 33 | Use `.flex-row` to set a horizontal direction (the browser default), or `.flex-row-reverse` to start the horizontal direction from the opposite side. | |
| 34 | ||
| 35 | {% capture example %} | |
| 36 | <div class="d-flex flex-row bd-highlight mb-3"> | |
| 37 | <div class="p-2 bd-highlight">Flex item 1</div> | |
| 38 | <div class="p-2 bd-highlight">Flex item 2</div> | |
| 39 | <div class="p-2 bd-highlight">Flex item 3</div> | |
| 40 | </div> | |
| 41 | <div class="d-flex flex-row-reverse bd-highlight"> | |
| 42 | <div class="p-2 bd-highlight">Flex item 1</div> | |
| 43 | <div class="p-2 bd-highlight">Flex item 2</div> | |
| 44 | <div class="p-2 bd-highlight">Flex item 3</div> | |
| 45 | </div> | |
| 46 | {% endcapture %} | |
| 47 | {% include example.html content=example %} | |
| 48 | ||
| 49 | Use `.flex-column` to set a vertical direction, or `.flex-column-reverse` to start the vertical direction from the opposite side. | |
| 50 | ||
| 51 | {% capture example %} | |
| 52 | <div class="d-flex flex-column bd-highlight mb-3"> | |
| 53 | <div class="p-2 bd-highlight">Flex item 1</div> | |
| 54 | <div class="p-2 bd-highlight">Flex item 2</div> | |
| 55 | <div class="p-2 bd-highlight">Flex item 3</div> | |
| 56 | </div> | |
| 57 | <div class="d-flex flex-column-reverse bd-highlight"> | |
| 58 | <div class="p-2 bd-highlight">Flex item 1</div> | |
| 59 | <div class="p-2 bd-highlight">Flex item 2</div> | |
| 60 | <div class="p-2 bd-highlight">Flex item 3</div> | |
| 61 | </div> | |
| 62 | {% endcapture %} | |
| 63 | {% include example.html content=example %} | |
| 64 | ||
| 65 | Responsive variations also exist for `flex-direction`. | |
| 66 | ||
| 67 | {% for bp in site.data.breakpoints %} | |
| 68 | - `.flex{{ bp.abbr }}-row` | |
| 69 | - `.flex{{ bp.abbr }}-row-reverse` | |
| 70 | - `.flex{{ bp.abbr }}-column` | |
| 71 | - `.flex{{ bp.abbr }}-column-reverse`{% endfor %} | |
| 72 | ||
| 73 | ## Justify content | |
| 74 | ||
| 75 | Use `justify-content` utilities on flexbox containers to change the alignment of flex items on the main axis (the x-axis to start, y-axis if `flex-direction: column`). Choose from `start` (browser default), `end`, `center`, `between`, or `around`. | |
| 76 | ||
| 77 | <div class="bd-example"> | |
| 78 | <div class="d-flex justify-content-start bd-highlight mb-3"> | |
| 79 | <div class="p-2 bd-highlight">Flex item</div> | |
| 80 | <div class="p-2 bd-highlight">Flex item</div> | |
| 81 | <div class="p-2 bd-highlight">Flex item</div> | |
| 82 | </div> | |
| 83 | <div class="d-flex justify-content-end bd-highlight mb-3"> | |
| 84 | <div class="p-2 bd-highlight">Flex item</div> | |
| 85 | <div class="p-2 bd-highlight">Flex item</div> | |
| 86 | <div class="p-2 bd-highlight">Flex item</div> | |
| 87 | </div> | |
| 88 | <div class="d-flex justify-content-center bd-highlight mb-3"> | |
| 89 | <div class="p-2 bd-highlight">Flex item</div> | |
| 90 | <div class="p-2 bd-highlight">Flex item</div> | |
| 91 | <div class="p-2 bd-highlight">Flex item</div> | |
| 92 | </div> | |
| 93 | <div class="d-flex justify-content-between bd-highlight mb-3"> | |
| 94 | <div class="p-2 bd-highlight">Flex item</div> | |
| 95 | <div class="p-2 bd-highlight">Flex item</div> | |
| 96 | <div class="p-2 bd-highlight">Flex item</div> | |
| 97 | </div> | |
| 98 | <div class="d-flex justify-content-around bd-highlight"> | |
| 99 | <div class="p-2 bd-highlight">Flex item</div> | |
| 100 | <div class="p-2 bd-highlight">Flex item</div> | |
| 101 | <div class="p-2 bd-highlight">Flex item</div> | |
| 102 | </div> | |
| 103 | </div> | |
| 104 | ||
| 105 | {% highlight html %} | |
| 106 | <div class="d-flex justify-content-start">...</div> | |
| 107 | <div class="d-flex justify-content-end">...</div> | |
| 108 | <div class="d-flex justify-content-center">...</div> | |
| 109 | <div class="d-flex justify-content-between">...</div> | |
| 110 | <div class="d-flex justify-content-around">...</div> | |
| 111 | {% endhighlight %} | |
| 112 | ||
| 113 | Responsive variations also exist for `justify-content`. | |
| 114 | ||
| 115 | {% for bp in site.data.breakpoints %} | |
| 116 | - `.justify-content{{ bp.abbr }}-start` | |
| 117 | - `.justify-content{{ bp.abbr }}-end` | |
| 118 | - `.justify-content{{ bp.abbr }}-center` | |
| 119 | - `.justify-content{{ bp.abbr }}-between` | |
| 120 | - `.justify-content{{ bp.abbr }}-around`{% endfor %} | |
| 121 | ||
| 122 | ## Align items | |
| 123 | ||
| 124 | Use `align-items` utilities on flexbox containers to change the alignment of flex items on the cross axis (the y-axis to start, x-axis if `flex-direction: column`). Choose from `start`, `end`, `center`, `baseline`, or `stretch` (browser default). | |
| 125 | ||
| 126 | <div class="bd-example"> | |
| 127 | <div class="d-flex align-items-start bd-highlight mb-3" style="height: 100px"> | |
| 128 | <div class="p-2 bd-highlight">Flex item</div> | |
| 129 | <div class="p-2 bd-highlight">Flex item</div> | |
| 130 | <div class="p-2 bd-highlight">Flex item</div> | |
| 131 | </div> | |
| 132 | <div class="d-flex align-items-end bd-highlight mb-3" style="height: 100px"> | |
| 133 | <div class="p-2 bd-highlight">Flex item</div> | |
| 134 | <div class="p-2 bd-highlight">Flex item</div> | |
| 135 | <div class="p-2 bd-highlight">Flex item</div> | |
| 136 | </div> | |
| 137 | <div class="d-flex align-items-center bd-highlight mb-3" style="height: 100px"> | |
| 138 | <div class="p-2 bd-highlight">Flex item</div> | |
| 139 | <div class="p-2 bd-highlight">Flex item</div> | |
| 140 | <div class="p-2 bd-highlight">Flex item</div> | |
| 141 | </div> | |
| 142 | <div class="d-flex align-items-baseline bd-highlight mb-3" style="height: 100px"> | |
| 143 | <div class="p-2 bd-highlight">Flex item</div> | |
| 144 | <div class="p-2 bd-highlight">Flex item</div> | |
| 145 | <div class="p-2 bd-highlight">Flex item</div> | |
| 146 | </div> | |
| 147 | <div class="d-flex align-items-stretch bd-highlight" style="height: 100px"> | |
| 148 | <div class="p-2 bd-highlight">Flex item</div> | |
| 149 | <div class="p-2 bd-highlight">Flex item</div> | |
| 150 | <div class="p-2 bd-highlight">Flex item</div> | |
| 151 | </div> | |
| 152 | </div> | |
| 153 | ||
| 154 | {% highlight html %} | |
| 155 | <div class="d-flex align-items-start">...</div> | |
| 156 | <div class="d-flex align-items-end">...</div> | |
| 157 | <div class="d-flex align-items-center">...</div> | |
| 158 | <div class="d-flex align-items-baseline">...</div> | |
| 159 | <div class="d-flex align-items-stretch">...</div> | |
| 160 | {% endhighlight %} | |
| 161 | ||
| 162 | Responsive variations also exist for `align-items`. | |
| 163 | ||
| 164 | {% for bp in site.data.breakpoints %} | |
| 165 | - `.align-items{{ bp.abbr }}-start` | |
| 166 | - `.align-items{{ bp.abbr }}-end` | |
| 167 | - `.align-items{{ bp.abbr }}-center` | |
| 168 | - `.align-items{{ bp.abbr }}-baseline` | |
| 169 | - `.align-items{{ bp.abbr }}-stretch`{% endfor %} | |
| 170 | ||
| 171 | ## Align self | |
| 172 | ||
| 173 | Use `align-self` utilities on flexbox items to individually change their alignment on the cross axis (the y-axis to start, x-axis if `flex-direction: column`). Choose from the same options as `align-items`: `start`, `end`, `center`, `baseline`, or `stretch` (browser default). | |
| 174 | ||
| 175 | <div class="bd-example"> | |
| 176 | <div class="d-flex bd-highlight mb-3" style="height: 100px"> | |
| 177 | <div class="p-2 bd-highlight">Flex item</div> | |
| 178 | <div class="align-self-start p-2 bd-highlight">Aligned flex item</div> | |
| 179 | <div class="p-2 bd-highlight">Flex item</div> | |
| 180 | </div> | |
| 181 | <div class="d-flex bd-highlight mb-3" style="height: 100px"> | |
| 182 | <div class="p-2 bd-highlight">Flex item</div> | |
| 183 | <div class="align-self-end p-2 bd-highlight">Aligned flex item</div> | |
| 184 | <div class="p-2 bd-highlight">Flex item</div> | |
| 185 | </div> | |
| 186 | <div class="d-flex bd-highlight mb-3" style="height: 100px"> | |
| 187 | <div class="p-2 bd-highlight">Flex item</div> | |
| 188 | <div class="align-self-center p-2 bd-highlight">Aligned flex item</div> | |
| 189 | <div class="p-2 bd-highlight">Flex item</div> | |
| 190 | </div> | |
| 191 | <div class="d-flex bd-highlight mb-3" style="height: 100px"> | |
| 192 | <div class="p-2 bd-highlight">Flex item</div> | |
| 193 | <div class="align-self-baseline p-2 bd-highlight">Aligned flex item</div> | |
| 194 | <div class="p-2 bd-highlight">Flex item</div> | |
| 195 | </div> | |
| 196 | <div class="d-flex bd-highlight" style="height: 100px"> | |
| 197 | <div class="p-2 bd-highlight">Flex item</div> | |
| 198 | <div class="align-self-stretch p-2 bd-highlight">Aligned flex item</div> | |
| 199 | <div class="p-2 bd-highlight">Flex item</div> | |
| 200 | </div> | |
| 201 | </div> | |
| 202 | ||
| 203 | {% highlight html %} | |
| 204 | <div class="align-self-start">Aligned flex item</div> | |
| 205 | <div class="align-self-end">Aligned flex item</div> | |
| 206 | <div class="align-self-center">Aligned flex item</div> | |
| 207 | <div class="align-self-baseline">Aligned flex item</div> | |
| 208 | <div class="align-self-stretch">Aligned flex item</div> | |
| 209 | {% endhighlight %} | |
| 210 | ||
| 211 | Responsive variations also exist for `align-self`. | |
| 212 | ||
| 213 | {% for bp in site.data.breakpoints %} | |
| 214 | - `.align-self{{ bp.abbr }}-start` | |
| 215 | - `.align-self{{ bp.abbr }}-end` | |
| 216 | - `.align-self{{ bp.abbr }}-center` | |
| 217 | - `.align-self{{ bp.abbr }}-baseline` | |
| 218 | - `.align-self{{ bp.abbr }}-stretch`{% endfor %} | |
| 219 | ||
| 220 | ## Fill | |
| 221 | ||
| 222 | Use the `.flex-fill` class on a series of sibling elements to force them into widths equal to their content (or equal widths if their content does not surpass their border-boxes) while taking up all available horizontal space. | |
| 223 | ||
| 224 | {% capture example %} | |
| 225 | <div class="d-flex bd-highlight"> | |
| 226 | <div class="p-2 flex-fill bd-highlight">Flex item with a lot of content</div> | |
| 227 | <div class="p-2 flex-fill bd-highlight">Flex item</div> | |
| 228 | <div class="p-2 flex-fill bd-highlight">Flex item</div> | |
| 229 | </div> | |
| 230 | {% endcapture %} | |
| 231 | {% include example.html content=example %} | |
| 232 | ||
| 233 | Responsive variations also exist for `flex-fill`. | |
| 234 | ||
| 235 | {% for bp in site.data.breakpoints %} | |
| 236 | - `.flex{{ bp.abbr }}-fill`{% endfor %} | |
| 237 | ||
| 238 | ## Grow and shrink | |
| 239 | ||
| 240 | Use `.flex-grow-*` utilities to toggle a flex item's ability to grow to fill available space. In the example below, the `.flex-grow-1` elements uses all available space it can, while allowing the remaining two flex items their necessary space. | |
| 241 | ||
| 242 | {% capture example %} | |
| 243 | <div class="d-flex bd-highlight"> | |
| 244 | <div class="p-2 flex-grow-1 bd-highlight">Flex item</div> | |
| 245 | <div class="p-2 bd-highlight">Flex item</div> | |
| 246 | <div class="p-2 bd-highlight">Third flex item</div> | |
| 247 | </div> | |
| 248 | {% endcapture %} | |
| 249 | {% include example.html content=example %} | |
| 250 | ||
| 251 | Use `.flex-shrink-*` utilities to toggle a flex item's ability to shrink if necessary. In the example below, the second flex item with `.flex-shrink-1` is forced to wrap it's contents to a new line, "shrinking" to allow more space for the previous flex item with `.w-100`. | |
| 252 | ||
| 253 | {% capture example %} | |
| 254 | <div class="d-flex bd-highlight"> | |
| 255 | <div class="p-2 w-100 bd-highlight">Flex item</div> | |
| 256 | <div class="p-2 flex-shrink-1 bd-highlight">Flex item</div> | |
| 257 | </div> | |
| 258 | {% endcapture %} | |
| 259 | {% include example.html content=example %} | |
| 260 | ||
| 261 | Responsive variations also exist for `flex-grow` and `flex-shrink`. | |
| 262 | ||
| 263 | {% for bp in site.data.breakpoints %} | |
| 264 | - `.flex{{ bp.abbr }}-{grow|shrink}-0` | |
| 265 | - `.flex{{ bp.abbr }}-{grow|shrink}-1`{% endfor %} | |
| 266 | ||
| 267 | ## Auto margins | |
| 268 | ||
| 269 | Flexbox can do some pretty awesome things when you mix flex alignments with auto margins. Shown below are three examples of controlling flex items via auto margins: default (no auto margin), pushing two items to the right (`.mr-auto`), and pushing two items to the left (`.ml-auto`). | |
| 270 | ||
| 271 | **Unfortunately, IE10 and IE11 do not properly support auto margins on flex items whose parent has a non-default `justify-content` value.** [See this StackOverflow answer](https://stackoverflow.com/a/37535548) for more details. | |
| 272 | ||
| 273 | {% capture example %} | |
| 274 | <div class="d-flex bd-highlight mb-3"> | |
| 275 | <div class="p-2 bd-highlight">Flex item</div> | |
| 276 | <div class="p-2 bd-highlight">Flex item</div> | |
| 277 | <div class="p-2 bd-highlight">Flex item</div> | |
| 278 | </div> | |
| 279 | ||
| 280 | <div class="d-flex bd-highlight mb-3"> | |
| 281 | <div class="mr-auto p-2 bd-highlight">Flex item</div> | |
| 282 | <div class="p-2 bd-highlight">Flex item</div> | |
| 283 | <div class="p-2 bd-highlight">Flex item</div> | |
| 284 | </div> | |
| 285 | ||
| 286 | <div class="d-flex bd-highlight mb-3"> | |
| 287 | <div class="p-2 bd-highlight">Flex item</div> | |
| 288 | <div class="p-2 bd-highlight">Flex item</div> | |
| 289 | <div class="ml-auto p-2 bd-highlight">Flex item</div> | |
| 290 | </div> | |
| 291 | {% endcapture %} | |
| 292 | {% include example.html content=example %} | |
| 293 | ||
| 294 | ### With align-items | |
| 295 | ||
| 296 | Vertically move one flex item to the top or bottom of a container by mixing `align-items`, `flex-direction: column`, and `margin-top: auto` or `margin-bottom: auto`. | |
| 297 | ||
| 298 | {% capture example %} | |
| 299 | <div class="d-flex align-items-start flex-column bd-highlight mb-3" style="height: 200px;"> | |
| 300 | <div class="mb-auto p-2 bd-highlight">Flex item</div> | |
| 301 | <div class="p-2 bd-highlight">Flex item</div> | |
| 302 | <div class="p-2 bd-highlight">Flex item</div> | |
| 303 | </div> | |
| 304 | ||
| 305 | <div class="d-flex align-items-end flex-column bd-highlight mb-3" style="height: 200px;"> | |
| 306 | <div class="p-2 bd-highlight">Flex item</div> | |
| 307 | <div class="p-2 bd-highlight">Flex item</div> | |
| 308 | <div class="mt-auto p-2 bd-highlight">Flex item</div> | |
| 309 | </div> | |
| 310 | {% endcapture %} | |
| 311 | {% include example.html content=example %} | |
| 312 | ||
| 313 | ## Wrap | |
| 314 | ||
| 315 | Change how flex items wrap in a flex container. Choose from no wrapping at all (the browser default) with `.flex-nowrap`, wrapping with `.flex-wrap`, or reverse wrapping with `.flex-wrap-reverse`. | |
| 316 | ||
| 317 | <div class="bd-example"> | |
| 318 | <div class="d-flex flex-nowrap bd-highlight" style="width: 8rem;"> | |
| 319 | <div class="p-2 bd-highlight">Flex item</div> | |
| 320 | <div class="p-2 bd-highlight">Flex item</div> | |
| 321 | <div class="p-2 bd-highlight">Flex item</div> | |
| 322 | <div class="p-2 bd-highlight">Flex item</div> | |
| 323 | <div class="p-2 bd-highlight">Flex item</div> | |
| 324 | </div> | |
| 325 | </div> | |
| 326 | ||
| 327 | {% highlight html %} | |
| 328 | <div class="d-flex flex-nowrap"> | |
| 329 | ... | |
| 330 | </div> | |
| 331 | {% endhighlight %} | |
| 332 | ||
| 333 | <div class="bd-example"> | |
| 334 | <div class="d-flex flex-wrap bd-highlight"> | |
| 335 | <div class="p-2 bd-highlight">Flex item</div> | |
| 336 | <div class="p-2 bd-highlight">Flex item</div> | |
| 337 | <div class="p-2 bd-highlight">Flex item</div> | |
| 338 | <div class="p-2 bd-highlight">Flex item</div> | |
| 339 | <div class="p-2 bd-highlight">Flex item</div> | |
| 340 | <div class="p-2 bd-highlight">Flex item</div> | |
| 341 | <div class="p-2 bd-highlight">Flex item</div> | |
| 342 | <div class="p-2 bd-highlight">Flex item</div> | |
| 343 | <div class="p-2 bd-highlight">Flex item</div> | |
| 344 | <div class="p-2 bd-highlight">Flex item</div> | |
| 345 | <div class="p-2 bd-highlight">Flex item</div> | |
| 346 | <div class="p-2 bd-highlight">Flex item</div> | |
| 347 | <div class="p-2 bd-highlight">Flex item</div> | |
| 348 | <div class="p-2 bd-highlight">Flex item</div> | |
| 349 | <div class="p-2 bd-highlight">Flex item</div> | |
| 350 | </div> | |
| 351 | </div> | |
| 352 | ||
| 353 | {% highlight html %} | |
| 354 | <div class="d-flex flex-wrap"> | |
| 355 | ... | |
| 356 | </div> | |
| 357 | {% endhighlight %} | |
| 358 | ||
| 359 | <div class="bd-example"> | |
| 360 | <div class="d-flex flex-wrap-reverse bd-highlight"> | |
| 361 | <div class="p-2 bd-highlight">Flex item</div> | |
| 362 | <div class="p-2 bd-highlight">Flex item</div> | |
| 363 | <div class="p-2 bd-highlight">Flex item</div> | |
| 364 | <div class="p-2 bd-highlight">Flex item</div> | |
| 365 | <div class="p-2 bd-highlight">Flex item</div> | |
| 366 | <div class="p-2 bd-highlight">Flex item</div> | |
| 367 | <div class="p-2 bd-highlight">Flex item</div> | |
| 368 | <div class="p-2 bd-highlight">Flex item</div> | |
| 369 | <div class="p-2 bd-highlight">Flex item</div> | |
| 370 | <div class="p-2 bd-highlight">Flex item</div> | |
| 371 | <div class="p-2 bd-highlight">Flex item</div> | |
| 372 | <div class="p-2 bd-highlight">Flex item</div> | |
| 373 | <div class="p-2 bd-highlight">Flex item</div> | |
| 374 | <div class="p-2 bd-highlight">Flex item</div> | |
| 375 | <div class="p-2 bd-highlight">Flex item</div> | |
| 376 | </div> | |
| 377 | </div> | |
| 378 | ||
| 379 | {% highlight html %} | |
| 380 | <div class="d-flex flex-wrap-reverse"> | |
| 381 | ... | |
| 382 | </div> | |
| 383 | {% endhighlight %} | |
| 384 | ||
| 385 | ||
| 386 | Responsive variations also exist for `flex-wrap`. | |
| 387 | ||
| 388 | {% for bp in site.data.breakpoints %} | |
| 389 | - `.flex{{ bp.abbr }}-nowrap` | |
| 390 | - `.flex{{ bp.abbr }}-wrap` | |
| 391 | - `.flex{{ bp.abbr }}-wrap-reverse`{% endfor %} | |
| 392 | ||
| 393 | ## Order | |
| 394 | ||
| 395 | Change the _visual_ order of specific flex items with a handful of `order` utilities. We only provide options for making an item first or last, as well as a reset to use the DOM order. As `order` takes any integer value (e.g., `5`), add custom CSS for any additional values needed. | |
| 396 | ||
| 397 | {% capture example %} | |
| 398 | <div class="d-flex flex-nowrap bd-highlight"> | |
| 399 | <div class="order-3 p-2 bd-highlight">First flex item</div> | |
| 400 | <div class="order-2 p-2 bd-highlight">Second flex item</div> | |
| 401 | <div class="order-1 p-2 bd-highlight">Third flex item</div> | |
| 402 | </div> | |
| 403 | {% endcapture %} | |
| 404 | {% include example.html content=example %} | |
| 405 | ||
| 406 | Responsive variations also exist for `order`. | |
| 407 | ||
| 408 | {% for bp in site.data.breakpoints %}{% for i in (0..12) %} | |
| 409 | - `.order{{ bp.abbr }}-{{ i }}`{% endfor %}{% endfor %} | |
| 410 | ||
| 411 | ## Align content | |
| 412 | ||
| 413 | Use `align-content` utilities on flexbox containers to align flex items *together* on the cross axis. Choose from `start` (browser default), `end`, `center`, `between`, `around`, or `stretch`. To demonstrate these utilities, we've enforced `flex-wrap: wrap` and increased the number of flex items. | |
| 414 | ||
| 415 | **Heads up!** This property has no effect on single rows of flex items. | |
| 416 | ||
| 417 | <div class="bd-example"> | |
| 418 | <div class="d-flex align-content-start flex-wrap bd-highlight mb-3" style="height: 200px"> | |
| 419 | <div class="p-2 bd-highlight">Flex item</div> | |
| 420 | <div class="p-2 bd-highlight">Flex item</div> | |
| 421 | <div class="p-2 bd-highlight">Flex item</div> | |
| 422 | <div class="p-2 bd-highlight">Flex item</div> | |
| 423 | <div class="p-2 bd-highlight">Flex item</div> | |
| 424 | <div class="p-2 bd-highlight">Flex item</div> | |
| 425 | <div class="p-2 bd-highlight">Flex item</div> | |
| 426 | <div class="p-2 bd-highlight">Flex item</div> | |
| 427 | <div class="p-2 bd-highlight">Flex item</div> | |
| 428 | <div class="p-2 bd-highlight">Flex item</div> | |
| 429 | <div class="p-2 bd-highlight">Flex item</div> | |
| 430 | <div class="p-2 bd-highlight">Flex item</div> | |
| 431 | <div class="p-2 bd-highlight">Flex item</div> | |
| 432 | <div class="p-2 bd-highlight">Flex item</div> | |
| 433 | <div class="p-2 bd-highlight">Flex item</div> | |
| 434 | </div> | |
| 435 | </div> | |
| 436 | ||
| 437 | {% highlight html %} | |
| 438 | <div class="d-flex align-content-start flex-wrap"> | |
| 439 | ... | |
| 440 | </div> | |
| 441 | {% endhighlight %} | |
| 442 | ||
| 443 | <div class="bd-example"> | |
| 444 | <div class="d-flex align-content-end flex-wrap bd-highlight mb-3" style="height: 200px"> | |
| 445 | <div class="p-2 bd-highlight">Flex item</div> | |
| 446 | <div class="p-2 bd-highlight">Flex item</div> | |
| 447 | <div class="p-2 bd-highlight">Flex item</div> | |
| 448 | <div class="p-2 bd-highlight">Flex item</div> | |
| 449 | <div class="p-2 bd-highlight">Flex item</div> | |
| 450 | <div class="p-2 bd-highlight">Flex item</div> | |
| 451 | <div class="p-2 bd-highlight">Flex item</div> | |
| 452 | <div class="p-2 bd-highlight">Flex item</div> | |
| 453 | <div class="p-2 bd-highlight">Flex item</div> | |
| 454 | <div class="p-2 bd-highlight">Flex item</div> | |
| 455 | <div class="p-2 bd-highlight">Flex item</div> | |
| 456 | <div class="p-2 bd-highlight">Flex item</div> | |
| 457 | <div class="p-2 bd-highlight">Flex item</div> | |
| 458 | <div class="p-2 bd-highlight">Flex item</div> | |
| 459 | <div class="p-2 bd-highlight">Flex item</div> | |
| 460 | </div> | |
| 461 | </div> | |
| 462 | ||
| 463 | {% highlight html %} | |
| 464 | <div class="d-flex align-content-end flex-wrap">...</div> | |
| 465 | {% endhighlight %} | |
| 466 | ||
| 467 | <div class="bd-example"> | |
| 468 | <div class="d-flex align-content-center flex-wrap bd-highlight mb-3" style="height: 200px"> | |
| 469 | <div class="p-2 bd-highlight">Flex item</div> | |
| 470 | <div class="p-2 bd-highlight">Flex item</div> | |
| 471 | <div class="p-2 bd-highlight">Flex item</div> | |
| 472 | <div class="p-2 bd-highlight">Flex item</div> | |
| 473 | <div class="p-2 bd-highlight">Flex item</div> | |
| 474 | <div class="p-2 bd-highlight">Flex item</div> | |
| 475 | <div class="p-2 bd-highlight">Flex item</div> | |
| 476 | <div class="p-2 bd-highlight">Flex item</div> | |
| 477 | <div class="p-2 bd-highlight">Flex item</div> | |
| 478 | <div class="p-2 bd-highlight">Flex item</div> | |
| 479 | <div class="p-2 bd-highlight">Flex item</div> | |
| 480 | <div class="p-2 bd-highlight">Flex item</div> | |
| 481 | <div class="p-2 bd-highlight">Flex item</div> | |
| 482 | <div class="p-2 bd-highlight">Flex item</div> | |
| 483 | <div class="p-2 bd-highlight">Flex item</div> | |
| 484 | </div> | |
| 485 | </div> | |
| 486 | ||
| 487 | {% highlight html %} | |
| 488 | <div class="d-flex align-content-center flex-wrap">...</div> | |
| 489 | {% endhighlight %} | |
| 490 | ||
| 491 | <div class="bd-example"> | |
| 492 | <div class="d-flex align-content-between flex-wrap bd-highlight mb-3" style="height: 200px"> | |
| 493 | <div class="p-2 bd-highlight">Flex item</div> | |
| 494 | <div class="p-2 bd-highlight">Flex item</div> | |
| 495 | <div class="p-2 bd-highlight">Flex item</div> | |
| 496 | <div class="p-2 bd-highlight">Flex item</div> | |
| 497 | <div class="p-2 bd-highlight">Flex item</div> | |
| 498 | <div class="p-2 bd-highlight">Flex item</div> | |
| 499 | <div class="p-2 bd-highlight">Flex item</div> | |
| 500 | <div class="p-2 bd-highlight">Flex item</div> | |
| 501 | <div class="p-2 bd-highlight">Flex item</div> | |
| 502 | <div class="p-2 bd-highlight">Flex item</div> | |
| 503 | <div class="p-2 bd-highlight">Flex item</div> | |
| 504 | <div class="p-2 bd-highlight">Flex item</div> | |
| 505 | <div class="p-2 bd-highlight">Flex item</div> | |
| 506 | <div class="p-2 bd-highlight">Flex item</div> | |
| 507 | <div class="p-2 bd-highlight">Flex item</div> | |
| 508 | </div> | |
| 509 | </div> | |
| 510 | ||
| 511 | {% highlight html %} | |
| 512 | <div class="d-flex align-content-between flex-wrap">...</div> | |
| 513 | {% endhighlight %} | |
| 514 | ||
| 515 | <div class="bd-example"> | |
| 516 | <div class="d-flex align-content-around flex-wrap bd-highlight mb-3" style="height: 200px"> | |
| 517 | <div class="p-2 bd-highlight">Flex item</div> | |
| 518 | <div class="p-2 bd-highlight">Flex item</div> | |
| 519 | <div class="p-2 bd-highlight">Flex item</div> | |
| 520 | <div class="p-2 bd-highlight">Flex item</div> | |
| 521 | <div class="p-2 bd-highlight">Flex item</div> | |
| 522 | <div class="p-2 bd-highlight">Flex item</div> | |
| 523 | <div class="p-2 bd-highlight">Flex item</div> | |
| 524 | <div class="p-2 bd-highlight">Flex item</div> | |
| 525 | <div class="p-2 bd-highlight">Flex item</div> | |
| 526 | <div class="p-2 bd-highlight">Flex item</div> | |
| 527 | <div class="p-2 bd-highlight">Flex item</div> | |
| 528 | <div class="p-2 bd-highlight">Flex item</div> | |
| 529 | <div class="p-2 bd-highlight">Flex item</div> | |
| 530 | <div class="p-2 bd-highlight">Flex item</div> | |
| 531 | <div class="p-2 bd-highlight">Flex item</div> | |
| 532 | </div> | |
| 533 | </div> | |
| 534 | ||
| 535 | {% highlight html %} | |
| 536 | <div class="d-flex align-content-around flex-wrap">...</div> | |
| 537 | {% endhighlight %} | |
| 538 | ||
| 539 | <div class="bd-example"> | |
| 540 | <div class="d-flex align-content-stretch flex-wrap bd-highlight mb-3" style="height: 200px"> | |
| 541 | <div class="p-2 bd-highlight">Flex item</div> | |
| 542 | <div class="p-2 bd-highlight">Flex item</div> | |
| 543 | <div class="p-2 bd-highlight">Flex item</div> | |
| 544 | <div class="p-2 bd-highlight">Flex item</div> | |
| 545 | <div class="p-2 bd-highlight">Flex item</div> | |
| 546 | <div class="p-2 bd-highlight">Flex item</div> | |
| 547 | <div class="p-2 bd-highlight">Flex item</div> | |
| 548 | <div class="p-2 bd-highlight">Flex item</div> | |
| 549 | <div class="p-2 bd-highlight">Flex item</div> | |
| 550 | <div class="p-2 bd-highlight">Flex item</div> | |
| 551 | <div class="p-2 bd-highlight">Flex item</div> | |
| 552 | <div class="p-2 bd-highlight">Flex item</div> | |
| 553 | <div class="p-2 bd-highlight">Flex item</div> | |
| 554 | <div class="p-2 bd-highlight">Flex item</div> | |
| 555 | <div class="p-2 bd-highlight">Flex item</div> | |
| 556 | </div> | |
| 557 | </div> | |
| 558 | ||
| 559 | {% highlight html %} | |
| 560 | <div class="d-flex align-content-stretch flex-wrap">...</div> | |
| 561 | {% endhighlight %} | |
| 562 | ||
| 563 | Responsive variations also exist for `align-content`. | |
| 564 | ||
| 565 | {% for bp in site.data.breakpoints %} | |
| 566 | - `.align-content{{ bp.abbr }}-start` | |
| 567 | - `.align-content{{ bp.abbr }}-end` | |
| 568 | - `.align-content{{ bp.abbr }}-center` | |
| 569 | - `.align-content{{ bp.abbr }}-around` | |
| 570 | - `.align-content{{ bp.abbr }}-stretch`{% endfor %} | |