Justify content
justify-content property. It controls how extra space is distributed between items in a flex or grid container along the main axis. flex-direction property sets the main and cross axis. The effects of justify-content change based on the container's direction.| CSS Shortcut class | Applied style |
|---|---|
| |
| |
| |
| |
| |
| |
Examples
Around
justify-content-around
In column layouts, spacing is vertical with half gaps on top and bottom.
1
2
3
<div class="d-flex justify-content-around">
<p>1</p>
<p>2</p>
<p>3</p>
</div> Between
justify-content-between
In column layouts, spacing is vertical between items only.
1
2
3
<div class="d-flex justify-content-between">
<p>1</p>
<p>2</p>
<p>3</p>
</div> Evenly
justify-content-evenly
In column layouts, spacing is equal vertically between and around items.
1
2
3
<div class="d-flex justify-content-evenly">
<p>1</p>
<p>2</p>
<p>3</p>
</div> Centre
justify-content-center
In column layouts, items are centred vertically.
1
2
3
<div class="d-flex justify-content-center">
<p>1</p>
<p>2</p>
<p>3</p>
</div> Start
justify-content-start
In column layouts, items align to the top.
1
2
3
<div class="d-flex justify-content-start">
<p>1</p>
<p>2</p>
<p>3</p>
</div> End
justify-content-end
In column layouts, items align to the bottom.
1
2
3
<div class="d-flex justify-content-end">
<p>1</p>
<p>2</p>
<p>3</p>
</div> xs:> 480pxsm:> 640pxmd:> 768pxlg:> 1024pxxl:> 1280px
<div class="xs:justify-content-center ...">
...
</div>