@@ -487,44 +487,74 @@ When the main axis wraps, this creates multiple main axis lines and adds extra s
487487Use this class to specify the ability of a flex item to alter its dimensions to fill available space.
488488
489489``` css
490- .flex-auto { flex : 1 1 auto ; }
491- .flex-grow-0 { flex-grow : 0 ; }
492- .flex-shrink-0 { flex-shrink : 0 ; }
490+ .flex-1 { flex : 1 ; }
491+ .flex-auto { flex : auto ; }
492+ .flex-grow-0 { flex-grow : 0 ; }
493+ .flex-shrink-0 { flex-shrink : 0 ; }
493494```
494495
495496| Class | Description |
496497| --- | --- |
497- | ` .flex-auto ` | Sets default values for ` flex-grow ` (1), ` flex-shrink ` (1) and ` flex-basis ` (auto) |
498- | ` .flex-grow-0 ` | Prevents growing of a flex item |
499- | ` .flex-shrink-0 ` | Prevents shrinking of a flex item |
498+ | ` .flex-1 ` | Fills available space |
499+ | ` .flex-auto ` | Fills available space and auto-sizes based on the content |
500+ | ` .flex-grow-0 ` | Prevents growing of a flex item |
501+ | ` .flex-shrink-0 ` | Prevents shrinking of a flex item |
502+
503+ #### flex-1
504+
505+ Adding ` .flex-1 ` makes the item grow in size to take up all the space that is available.
506+
507+ ``` html live
508+ <div class =" border d-flex" >
509+ <div class =" p-5 border bg-gray-light" >flex item</div >
510+ <div class =" p-5 border bg-gray-light flex-1" >.flex-1</div >
511+ <div class =" p-5 border bg-gray-light" >flex item</div >
512+ </div >
513+ ```
514+
515+ Adding ` .flex-1 ` to all flex items results in each item having the same size.
516+
517+ ``` html live
518+ <div class =" border d-flex" >
519+ <div class =" p-5 border bg-gray-light flex-1" >.flex-1</div >
520+ <div class =" p-5 border bg-gray-light flex-1" >.flex-1</div >
521+ <div class =" p-5 border bg-gray-light flex-1" >.flex-1</div >
522+ </div >
523+ ```
500524
501525#### flex-auto
502526
527+ Using ` .flex-auto ` fills the available space but also takes the size of the content into account. Type in the editor below to see the effect.
528+
503529``` html live
504530<div class =" border d-flex" >
505- <div class =" p-5 border bg-gray-light flex-auto " >.flex-auto </div >
506- <div class =" p-5 border bg-gray-light flex-auto" >.flex-auto</div >
507- <div class =" p-5 border bg-gray-light flex-auto " >.flex-auto </div >
531+ <div class =" p-5 border bg-gray-light flex-1 " >.flex-1 </div >
532+ <div class =" p-5 border bg-gray-light flex-auto" >.flex-auto with a bit more text </div >
533+ <div class =" p-5 border bg-gray-light flex-1 " >.flex-1 </div >
508534</div >
509535```
510536
511537#### flex-grow-0
512538
539+ Add ` .flex-grow-0 ` to prevent an item from growing. This can be useful when used as a responsive variant. For example to stop growing when the viewport gets wider.
540+
513541``` html live
514542<div class =" border d-flex" >
515- <div class =" p-5 border bg-gray-light flex-auto " >. flex-auto </div >
516- <div class =" p-5 border bg-gray-light flex-auto flex-grow-0" >.flex-auto .flex-grow-0</div >
517- <div class =" p-5 border bg-gray-light flex-auto " >. flex-auto </div >
543+ <div class =" p-5 border bg-gray-light" > flex item </div >
544+ <div class =" p-5 border bg-gray-light flex-auto flex-md- grow-0" >.flex-auto .flex-md -grow-0</div >
545+ <div class =" p-5 border bg-gray-light" > flex item </div >
518546</div >
519547```
520548
521549#### flex-shrink-0
522550
551+ Add ` .flex-shrink-0 ` to prevent an item from shrinking. Note that for example text will not wrap and the flex items start to overflow if there is not enough space.
552+
523553``` html live
524- <div class =" border d-flex" style =" width : 450 px " >
525- <div class =" p-5 border bg-gray-light flex-auto " >. flex-auto </div >
526- <div class =" p-5 border bg-gray-light flex-auto flex- shrink-0" >.flex-auto .flex-shrink-0</div >
527- <div class =" p-5 border bg-gray-light flex-auto " >. flex-auto </div >
554+ <div class =" p-2 border d-flex" style =" max- width : 340 px " >
555+ <div class =" p-5 border bg-gray-light" > flex item </div >
556+ <div class =" p-5 border bg-gray-light flex-shrink-0" >.flex-shrink-0</div >
557+ <div class =" p-5 border bg-gray-light" > flex item </div >
528558</div >
529559```
530560
@@ -663,7 +693,6 @@ All flexbox utilities can be adjusted per [breakpoint](/css/objects/grid#breakpo
663693
664694- ` d-[breakpoint]-[property] ` for ` display `
665695- ` flex-[breakpoint]-[property]-[behavior] ` for various flex properties
666- - ` flex-[breakpoint]-item-equal ` for equal width and equal height flex items
667696
668697Each responsive style is applied to the specified breakpoint and up.
669698
@@ -682,8 +711,6 @@ Each responsive style is applied to the specified breakpoint and up.
682711.flex-lg-nowrap {}
683712
684713.flex-lg-self-start {}
685-
686- .flex-md-item-equal {}
687714```
688715
689716#### Example usage
@@ -698,16 +725,6 @@ Mixing flex properties:
698725</div >
699726```
700727
701- Using the equal width, equal height utilities:
702-
703- ``` html live
704- <div class =" border d-flex" >
705- <div class =" flex-md-item-equal p-3 border bg-gray-light" >Stuff and things</div >
706- <div class =" flex-md-item-equal p-3 border bg-gray-light" >More stuff<br > on multiple lines</div >
707- <div class =" flex-md-item-equal p-3 border bg-gray-light" >Hi mom</div >
708- </div >
709- ```
710-
711728## Example components
712729
713730The flex utilities can be used to create a number of components. Here are some examples.
0 commit comments