Flex
flex shorthand property on a flex item. It controls how the item grows, shrinks, and takes up space relative to its siblings inside a flex container. | CSS Shortcut class | Applied style |
|---|---|
| |
| |
| |
| |
Examples
Flex 1
flex-1
Short content.
Medium length content.
Content that takes up more space than the others.
<div class="d-flex">
<p class="flex-1">Short content.</p>
<p class="flex-1">Medium length content.</p>
<p class="flex-1">
Content that takes up more space than the others.
</p>
</div> Auto
flex-auto
Short content.
Medium length content.
Content that takes up more space than the others.
<div class="d-flex">
<p class="flex-auto">Short content.</p>
<p class="flex-auto">Medium length content.</p>
<p class="flex-auto">
Content that takes up more space than the others.
</p>
</div> Initial
flex-initial
Short content.
Medium length content.
Content that takes up more space than the others.
<div class="d-flex">
<p class="flex-initial">Short content.</p>
<p class="flex-initial">Medium length content.</p>
<p class="flex-initial">
Content that takes up more space than the others.
</p>
</div> None
flex-none
Short content.
Medium length content.
Content that takes up more space than the others.
<div class="d-flex">
<p class="flex-none">Short content.</p>
<p class="flex-none">Medium length content.</p>
<p class="flex-none">
Content that takes up more space than the others.
</p>
</div> xs:> 480pxsm:> 640pxmd:> 768pxlg:> 1024pxxl:> 1280px
<div class="xs:flex-1 ...">
...
</div>