Layout
Layout utility classes provide highly flexible, interchangeable options to change the document layout using display, alignment, float and columns.
Breakpoint
Breakpoints are based on minimum screen widths, the point where visual change occur. The syntax for each
breakpoint is used throughout Cocobits utility classes such as .p-md-6
which adds a padding of 40px
at the medium breakpoint.
Breakpoint | Syntax | Min-width |
---|---|---|
small | sm |
544px |
medium | md |
768px |
large | lg |
992px |
extra large | xl |
1200px |
This block starts with 0 padding but adds a 32px padding at the small breakpoint. Minimize the screen width to see the change.
<div class="p-0 p-sm-6">...</div>
Container
Use containers to set a defined width with auto right and left margins.
Class value | Breakpoint | Width | Margin |
---|---|---|---|
container-sm |
small | 544px | margin-right: auto margin-left: auto |
container-md |
medium | 768px | margin-right: auto margin-left: auto |
container-lg |
large | 992px | margin-right: auto margin-left: auto |
container-xl |
extra large | 1200px | margin-right: auto margin-left: auto |
container-full |
- | 100% | margin-right: 0px margin-left: 0px |
container |
- | - | margin-right: auto margin-left: auto |
This container starts at full width then resizes at the small breakpoint to the small container (container-sm) with a width of 544px and auto right and left margins.
<div class="container-full container-sm p-3">...</div>
Column
The grid can be adjusted using column utility classes of percentage-based widths. The grid is based on 12 columns
and is responsive. For example, col-md-1
is 1/12 of the parent element's width at the medium
breakpoint.
Column Width
Class value | Breakpoint | Width |
---|---|---|
col-{breakpoint}-1 |
sm, md, lg, xl | 1/12 |
col-{breakpoint}-2 |
sm, md, lg, xl | 2/12 |
col-{breakpoint}-3 |
sm, md, lg, xl | 3/12 |
col-{breakpoint}-4 |
sm, md, lg, xl | 4/12 |
col-{breakpoint}-5 |
sm, md, lg, xl | 5/12 |
col-{breakpoint}-6 |
sm, md, lg, xl | 6/12 |
col-{breakpoint}-7 |
sm, md, lg, xl | 7/12 |
col-{breakpoint}-8 |
sm, md, lg, xl | 8/12 |
col-{breakpoint}-9 |
sm, md, lg, xl | 9/12 |
col-{breakpoint}-10 |
sm, md, lg, xl | 10/12 |
col-{breakpoint}-11 |
sm, md, lg, xl | 11/12 |
col-{breakpoint}-12 |
sm, md, lg, xl | 12/12 |
col-sm-12
col-sm-1
col-sm-11
col-sm-2
col-sm-10
col-sm-3
col-sm-9
col-sm-4
col-sm-8
col-sm-5
col-sm-7
col-sm-6
col-sm-6
<div class="col-sm-12">...</div>
Fixed Column Width
Class value | Width |
---|---|
col-1 |
1/12 |
col-2 |
2/12 |
col-3 |
3/12 |
col-4 |
4/12 |
col-5 |
5/12 |
col-6 |
6/12 |
col-7 |
7/12 |
col-8 |
8/12 |
col-9 |
9/12 |
col-10 |
10/12 |
col-11 |
11/12 |
col-12 |
12/12 |
col-12
col-1
col-11
col-2
col-10
col-3
col-9
col-4
col-8
col-5
col-7
col-6
col-6
<div class="col-12">...</div>
Offset Column Width
Class value | Breakpoint | Width |
---|---|---|
offset-{breakpoint}-1 |
sm, md, lg, xl | 1/12 |
offset-{breakpoint}-2 |
sm, md, lg, xl | 2/12 |
offset-{breakpoint}-3 |
sm, md, lg, xl | 3/12 |
offset-{breakpoint}-4 |
sm, md, lg, xl | 4/12 |
offset-{breakpoint}-5 |
sm, md, lg, xl | 5/12 |
offset-{breakpoint}-6 |
sm, md, lg, xl | 6/12 |
offset-{breakpoint}-7 |
sm, md, lg, xl | 7/12 |
offset-{breakpoint}-8 |
sm, md, lg, xl | 8/12 |
offset-{breakpoint}-9 |
sm, md, lg, xl | 9/12 |
offset-{breakpoint}-10 |
sm, md, lg, xl | 10/12 |
offset-{breakpoint}-11 |
sm, md, lg, xl | 11/12 |
offset-sm-1
offset-sm-2
offset-sm-3
offset-sm-4
offset-sm-5
offset-sm-6
<div class="offset-sm-1 col-11">...</div>
Fixed Offset Column Width
Class value | Width |
---|---|
offset-1 |
1/12 |
offset-2 |
2/12 |
offset-3 |
3/12 |
offset-4 |
4/12 |
offset-5 |
5/12 |
offset-6 |
6/12 |
offset-7 |
7/12 |
offset-8 |
8/12 |
offset-9 |
9/12 |
offset-10 |
10/12 |
offset-11 |
11/12 |
offset-1
offset-2
offset-3
offset-4
offset-5
offset-6
<div class="offset-1 col-11">...</div>
Fixed Column Gutter
Gutter utility classes defines the space padding between elements with col-
utility class.
Class value | Gutter size |
---|---|
gutter-narrow |
16px |
gutter |
24px |
gutter-wide |
32px |
gutter-narrow
gutter-narrow
gutter-narrow
gutter
gutter
gutter
gutter-wide
gutter-wide
gutter-wide
<div class="d-flex gutter-wide"> <div class="col-4" >...</div> <div class="col-4" >...</div> <div class="col-4" >...</div> </div>
Width & Height
Fixed Height
Height utility classes are useful when requiring consistent heights such as borders or input fields.
Class value | Height |
---|---|
height-0 |
0 |
height-1 |
2px |
height-2 |
4px |
height-3 |
8px |
height-4 |
16px |
height-5 |
24px |
height-6 |
32px |
height-7 |
40px |
height-8 |
48px |
height-9 |
64px |
height-5
height-7
height-9
<div class="height-5">...</div>
Max Width & Height
Class value | Property style |
---|---|
width-fit |
max-width: 100% |
width-full |
width: 100% |
width-fit-content |
width: fit-content |
height-fit |
max-height: 100% |
height-full |
height: 100% |
height-fit-content |
height: fit-content |
Min-Width
Fixed breakpoint widths is useful for displaying collection of items with a horizontal scroll.
Class value | Property style |
---|---|
width-min-sm |
min-width: 544px |
width-min-md |
min-width: 768px |
width-min-lg |
min-width: 992px |
width-min-xl |
min-width: 1200px |
<div class="width-fit">...</div>
Display
Display of an element can be adjusted with utilities like d-block
, d-grid
and
d-flex
.
Class value | Breakpoint | Display style |
---|---|---|
d-{breakpoint}-none |
sm, md, lg, xl | none |
d-{breakpoint}-block |
sm, md, lg, xl | block |
d-{breakpoint}-grid |
sm, md, lg, xl | grid |
d-{breakpoint}-flex |
sm, md, lg, xl | flex |
d-{breakpoint}-inline |
sm, md, lg, xl | inline |
d-{breakpoint}-inline-block |
sm, md, lg, xl | inline-block |
d-{breakpoint}-table |
sm, md, lg, xl | table |
d-{breakpoint}-table-cell |
sm, md, lg, xl | table-cell |
d-none |
- | none |
d-block |
- | block |
d-grid |
- | grid |
d-flex |
- | flex |
d-inline |
- | inline |
d-inline-block |
- | inline-block |
d-table |
- | table |
d-table-cell |
- | table-cell |
Flexbox
Flex Row & Reverse
Class value | Breakpoint | Flex direction |
---|---|---|
flex-{breakpoint}-row |
sm, md, lg, xl | row |
flex-{breakpoint}-row-reverse |
sm, md, lg, xl | row-reverse |
flex-sm-row
flex-sm-row
flex-sm-row
flex-sm-row-reverse
flex-sm-row-reverse
flex-sm-row-reverse
<div class="d-flex flex-sm-row gap-flex-col-2"> <div>...</div> <div>...</div> <div>...</div> </div>
Flex Column & Column Reverse
Class value | Breakpoint | Flex direction |
---|---|---|
flex-{breakpoint}-col |
sm, md, lg, xl | column |
flex-{breakpoint}-col-reverse |
sm, md, lg, xl | column-reverse |
flex-sm-col
flex-sm-col
flex-sm-col
flex-sm-col-reverse
flex-sm-col-reverse
flex-sm-col-reverse
<div class="d-flex flex-sm-col-reverse gap-flex-row-reverse-2"> <div>...</div> <div>...</div> <div>...</div> </div>
Flex Wrap & Nowrap
Class value | Breakpoint | Wrap type |
---|---|---|
flex-{breakpoint}-wrap |
sm, md, lg, xl | wrap |
flex-{breakpoint}-nowrap |
sm, md, lg, xl | nowrap |
flex-{breakpoint}-wrap-reverse |
sm, md, lg, xl | wrap-reverse |
flex-sm-wrap
flex-sm-wrap
flex-sm-wrap
flex-sm-wrap
flex-sm-nowrap
flex-sm-nowrap
flex-sm-nowrap
flex-sm-nowrap
flex-wrap-reverse
flex-wrap-reverse
flex-wrap-reverse
flex-wrap-reverse
<div class="d-flex flex-sm-wrap-reverse gap-flex-2"> <div>...</div> <div>...</div> <div>...</div> <div>...</div> </div>
Flex Grow & Shrink
Class value | Breakpoint | Flex style |
---|---|---|
flex-{breakpoint}-1 |
sm, md, lg, xl | flex: 1 |
flex-{breakpoint}-auto |
sm, md, lg, xl | flex: auto |
flex-{breakpoint}-grow-0 |
sm, md, lg, xl | flex-grow: 0 |
flex-{breakpoint}-shrink-0 |
sm, md, lg, xl | flex-shrink: 0 |
col-1
flex-sm-1
col-4
col-1
flex-sm-auto
col-4
col-1
flex-sm-grow-0
col-4
col-1
flex-sm-shrink-0
col-4
<div class="d-flex gap-flex-col-2"> <div>...</div> <div class="flex-sm-1">...</div> <div>...</div> </div>
Flex Order
Class value | Breakpoint | Order |
---|---|---|
flex-{breakpoint}-order-n1 |
sm, md, lg, xl | -1 |
flex-{breakpoint}-order-1 |
sm, md, lg, xl | 1 |
flex-{breakpoint}-order-2 |
sm, md, lg, xl | 2 |
flex-{breakpoint}-order-none |
sm, md, lg, xl | inherit |
flex-sm-order-2
flex-sm-order-none
flex-sm-order-1
<div class="d-flex"> <div class="flex-sm-order-2"> 1 </div> <div class="flex-sm-order-none"> 2 </div> <div class="flex-sm-order-1"> 3 </div> </div>
Fixed Flex Properties
Class value | Property style |
---|---|
flex-row |
flex-direction: row |
flex-row-reverse |
flex-direction: row-reverse |
flex-col |
flex-direction: column |
flex-col-reverse |
flex-direction: column-reverse |
flex-wrap |
flex-wrap: wrap |
flex-nowrap |
flex-wrap: nowrap |
flex-wrap-reverse |
flex-wrap: wrap-reverse |
flex-1 |
flex: 1 |
flex-auto |
flex: auto |
flex-grow-0 |
flex-grow: 0 |
flex-shrink-0 |
flex-shrink: 0 |
flex-order-n1 |
order: -1 |
flex-order-1 |
order: 1 |
flex-order-2 |
order: 2 |
flex-order-none |
order: inherit |
Flex Gap
Flexbox gaps between elements are not widely supported by browsers so the gap utility classes are a temporary workaround.
Class value | Breakpoint | Gap size |
---|---|---|
gap-{breakpoint}-flex-0 |
sm, md, lg, xl | 0px |
gap-{breakpoint}-flex-1 |
sm, md, lg, xl | 4px |
gap-{breakpoint}-flex-2 |
sm, md, lg, xl | 8px |
gap-{breakpoint}-flex-3 |
sm, md, lg, xl | 16px |
gap-{breakpoint}-flex-4 |
sm, md, lg, xl | 24px |
gap-{breakpoint}-flex-5 |
sm, md, lg, xl | 32px |
gap-{breakpoint}-flex-6 |
sm, md, lg, xl | 40px |
gap-flex-2
gap-flex-2
gap-flex-2
<div class="d-flex flex-wrap gap-flex-2"> <div class="col-4">...</div> <div class="col-4">...</div> <div class="col-4">...</div> </div>
Flex Row Gap
The gap-{breakpoint}-flex-row-{integer}
adds a gap between rows.
gap-{breakpoint}-flex-row-reverse-{integer}
can be used for flex reverse rows.
Class value | Breakpoint | Gap size |
---|---|---|
gap-{breakpoint}-flex-row-0 |
sm, md, lg, xl | 0px |
gap-{breakpoint}-flex-row-1 |
sm, md, lg, xl | 4px |
gap-{breakpoint}-flex-row-2 |
sm, md, lg, xl | 8px |
gap-{breakpoint}-flex-row-3 |
sm, md, lg, xl | 16px |
gap-{breakpoint}-flex-row-4 |
sm, md, lg, xl | 24px |
gap-{breakpoint}-flex-row-5 |
sm, md, lg, xl | 32px |
gap-{breakpoint}-flex-row-6 |
sm, md, lg, xl | 40px |
gap-sm-row-3
gap-sm-row-3
gap-sm-row-3
<div class="d-flex flex-sm-col gap-sm-flex-row-3"> <div class="py-2 col-12">...</div> <div class="py-2 col-12">...</div> <div class="py-2 col-12">...</div> </div>
Flex Column Gap
The gap-{breakpoint}-flex-col-{integer}
adds a gap between columns.
gap-{breakpoint}-flex-col-reverse-{integer}
can be used for reverse flex columns.
Class value | Breakpoint | Gap size |
---|---|---|
gap-{breakpoint}-flex-col-0 |
sm, md, lg, xl | 0px |
gap-{breakpoint}-flex-col-1 |
sm, md, lg, xl | 4px |
gap-{breakpoint}-flex-col-2 |
sm, md, lg, xl | 8px |
gap-{breakpoint}-flex-col-3 |
sm, md, lg, xl | 16px |
gap-{breakpoint}-flex-col-4 |
sm, md, lg, xl | 24px |
gap-{breakpoint}-flex-col-5 |
sm, md, lg, xl | 32px |
gap-{breakpoint}-flex-col-6 |
sm, md, lg, xl | 40px |
gap-sm-col-3
gap-sm-col-3
gap-sm-col-3
gap-sm-col-3
<div class="d-flex flex-row gap-sm-flex-col-3"> <div class="col-4">...</div> <div class="col-4">...</div> <div class="col-4">...</div> <div class="col-4">...</div> </div>
Fixed Flex Gap
Fixed versions of the flex gaps are available as well as reverse flex gaps such as
gap-flex-col-reverse-{integer}
and gap-flex-row-reverse-{integer}
.
Class value | Gap scale |
---|---|
gap-flex-{integer} |
0-6 |
gap-flex-row-{integer} |
0-6 |
gap-flex-column-{integer} |
0-6 |
Grid
Grid Flow Direction
Set the direction of the display element using the grid flow utility classes.
Class value | Grid flow |
---|---|
grid-flow-row |
row |
grid-flow-col |
column |
grid-flow-row-dense |
row dense |
grid-flow-col-dense |
column dense |
Grid Auto Size
Specifies the size of an implicitly-created grid row or column.
Class value | Auto size |
---|---|
grid-auto-rows-min |
min-content |
grid-auto-rows-max |
max-content |
grid-auto-cols-min |
min-content |
grid-auto-cols-max |
max-content |
Grid Repeat Column
Create repeat of equal width elements using the grid column utility classes.
Class value | Breakpoint | Repeat columns |
---|---|---|
grid-{breakpoint}-col-1 |
sm, md, lg, xl | 1 |
grid-{breakpoint}-col-2 |
sm, md, lg, xl | 2 |
grid-{breakpoint}-col-3 |
sm, md, lg, xl | 3 |
grid-{breakpoint}-col-4 |
sm, md, lg, xl | 5 |
grid-{breakpoint}-col-6 |
sm, md, lg, xl | 6 |
grid-{breakpoint}-col-7 |
sm, md, lg, xl | 7 |
grid-{breakpoint}-col-8 |
sm, md, lg, xl | 8 |
grid-{breakpoint}-col-9 |
sm, md, lg, xl | 9 |
grid-{breakpoint}-col-10 |
sm, md, lg, xl | 10 |
grid-{breakpoint}-col-11 |
sm, md, lg, xl | 11 |
grid-{breakpoint}-col-12 |
sm, md, lg, xl | 12 |
grid-sm-col-3
grid-sm-col-3
grid-sm-col-3
<div class="d-grid grid-sm-col-3"> <div>...</div> <div>...</div> <div>...</div> </div>
Fixed Grid Repeat Column
Class value | Repeat columns |
---|---|
grid-col-0 |
none |
grid-col-1 |
1 |
grid-col-2 |
2 |
grid-col-3 |
3 |
grid-col-4 |
5 |
grid-col-6 |
6 |
grid-col-7 |
7 |
grid-col-8 |
8 |
grid-col-9 |
9 |
grid-col-10 |
10 |
grid-col-11 |
11 |
grid-col-12 |
12 |
grid-col-4
grid-col-4
grid-col-4
grid-col-4
<div class="d-grid grid-col-4"> <div>...</div> <div>...</div> <div>...</div> <div>...</div> </div>
Grid Gap
The grid gap utility classes add equal width margins between display grid columns and rows.
Class value | Breakpoint | Gap size |
---|---|---|
gap-{breakpoint}-0 |
sm, md, lg, xl | 0px |
gap-{breakpoint}-1 |
sm, md, lg, xl | 4px |
gap-{breakpoint}-2 |
sm, md, lg, xl | 8px |
gap-{breakpoint}-3 |
sm, md, lg, xl | 16px |
gap-{breakpoint}-4 |
sm, md, lg, xl | 24px |
gap-{breakpoint}-5 |
sm, md, lg, xl | 32px |
gap-{breakpoint}-6 |
sm, md, lg, xl | 40px |
gap-sm-1
gap-sm-1
gap-sm-1
gap-sm-1
gap-sm-2
gap-sm-2
gap-sm-2
gap-sm-2
gap-sm-3
gap-sm-3
gap-sm-3
gap-sm-3
gap-sm-4
gap-sm-4
gap-sm-4
gap-sm-4
gap-sm-5
gap-sm-5
gap-sm-5
gap-sm-5
gap-sm-6
gap-sm-6
gap-sm-6
gap-sm-6
<div class="d-grid grid-col-4 gap-sm-6"> <div>...</div> <div>...</div> <div>...</div> <div>...</div> </div>
Grid Row Gap
The gap-{breakpoint}-row-{integer}
adds a gap between rows.
Class value | Breakpoint | Gap size |
---|---|---|
gap-{breakpoint}-row-0 |
sm, md, lg, xl | 0px |
gap-{breakpoint}-row-1 |
sm, md, lg, xl | 4px |
gap-{breakpoint}-row-2 |
sm, md, lg, xl | 8px |
gap-{breakpoint}-row-3 |
sm, md, lg, xl | 16px |
gap-{breakpoint}-row-4 |
sm, md, lg, xl | 24px |
gap-{breakpoint}-row-5 |
sm, md, lg, xl | 32px |
gap-{breakpoint}-row-6 |
sm, md, lg, xl | 40px |
gap-sm-row-3
gap-sm-row-3
gap-sm-row-3
<div class="d-grid grid-col-1 gap-row-3"> <div>...</div> <div>...</div> <div>...</div> </div>
Grid Column Gap
The gap-{breakpoint}-col-{integer}
adds a gap between columns.
Class value | Breakpoint | Gap size |
---|---|---|
gap-{breakpoint}-col-0 |
sm, md, lg, xl | 0px |
gap-{breakpoint}-col-1 |
sm, md, lg, xl | 4px |
gap-{breakpoint}-col-2 |
sm, md, lg, xl | 8px |
gap-{breakpoint}-col-3 |
sm, md, lg, xl | 16px |
gap-{breakpoint}-col-4 |
sm, md, lg, xl | 24px |
gap-{breakpoint}-col-5 |
sm, md, lg, xl | 32px |
gap-{breakpoint}-col-6 |
sm, md, lg, xl | 40px |
gap-sm-col-3
gap-sm-col-3
gap-sm-col-3
gap-sm-col-3
<div class="d-grid grid-col-4 gap-sm-col-3"> <div>...</div> <div>...</div> <div>...</div> <div>...</div> </div>
Fixed Grid Gap
Fixed versions of the grid gaps are available using the gap-{integer}
,
gap-row-{integer}
and gap-col-{integer}
classes.
Class value | Gap size |
---|---|
gap-0 |
0px |
gap-1 |
4px |
gap-2 |
8px |
gap-3 |
16px |
gap-4 |
24px |
gap-5 |
32px |
gap-6 |
40px |
Align
Display align utility classes aligns elements within flex and grid boxes.
Property | Class value | Axis | Applies to | Aligns |
---|---|---|---|---|
justify-content | d-justify-between |
main inline |
block, flex, grid | content within element by adjusting gap size |
justify-items | d-align-center |
main inline |
block, grid | child elements within element by adjusting its own padding |
align-content | d-content-between |
cross block |
block, flex, grid | content within element by adjusting padding |
align-items | d-items-center |
cross block |
flex, grid | child elements inside box by adjusting padding |
align-self | d-self-start |
cross block |
absolutely-position boxes, flex, grid | element within parent by adjusting margin |
Justify Content
Aligns elements by adjusting the gap size along the main axis.
Class value | Breakpoint | Justify content |
---|---|---|
d-{breakpoint}-justify-start |
sm, md, lg, xl | start |
d-{breakpoint}-justify-flex-end |
sm, md, lg, xl | flex-end |
d-{breakpoint}-justify-end |
sm, md, lg, xl | end |
d-{breakpoint}-justify-center |
sm, md, lg, xl | center |
d-{breakpoint}-justify-between |
sm, md, lg, xl | space-between |
d-{breakpoint}-justify-around |
sm, md, lg, xl | space-around |
d-{breakpoint}-justify-evenly |
sm, md, lg, xl | space-evenly |
d-sm-justify-start
d-sm-justify-center
d-sm-justify-end
d-sm-justify-between
d-sm-justify-between
d-sm-justify-between
d-sm-justify-around
d-sm-justify-around
d-sm-justify-around
d-sm-justify-evenly
d-sm-justify-evenly
d-sm-justify-evenly
<div class="d-grid d-sm-justify-evenly grid-flow-col"> <div>...</div> <div>...</div> <div>...</div> </div>
Justify Items
Aligns elements by adjusting the padding within its container along the main axis.
Class value | Breakpoint | Justify items |
---|---|---|
d-{breakpoint}-align-start |
sm, md, lg, xl | start |
d-{breakpoint}-align-end |
sm, md, lg, xl | end |
d-{breakpoint}-align-center |
sm, md, lg, xl | center |
d-{breakpoint}-align-stretch |
sm, md, lg, xl | stretch |
d-sm-align-start
d-sm-align-start
d-sm-align-start
d-sm-align-center
d-sm-align-center
d-sm-align-center
d-sm-align-end
d-sm-align-end
d-sm-align-end
<div class="d-grid grid-col-3 d-sm-align-center"> <div>...</div> <div>...</div> <div>...</div> </div>
Align Content
Align elements that wrap by adjusting the gap size along the cross axis.
Class value | Breakpoint | Align content |
---|---|---|
d-{breakpoint}-content-start |
sm, md, lg, xl | start |
d-{breakpoint}-content-end |
sm, md, lg, xl | end |
d-{breakpoint}-content-center |
sm, md, lg, xl | center |
d-{breakpoint}-content-between |
sm, md, lg, xl | space-between |
d-{breakpoint}-content-around |
sm, md, lg, xl | space-around |
d-{breakpoint}-content-stretch |
sm, md, lg, xl | stretch |
d-sm-content-start
d-sm-content-start
d-sm-content-start
d-sm-content-end
d-sm-content-end
d-sm-content-end
d-sm-content-center
d-sm-content-center
d-sm-content-center
d-sm-content-between
d-sm-content-between
d-sm-content-between
d-sm-content-around
d-sm-content-around
d-sm-content-around
d-sm-content-stretch
d-sm-content-stretch
d-sm-content-stretch
<div class="d-grid grid-col-2 d-sm-content-around"> <div>...</div> <div>...</div> <div>...</div> </div>
Align Inline-items
Align elements that wrap by adjusting the padding within its container along the cross axis.
Class value | Breakpoint | Align items |
---|---|---|
d-{breakpoint}-items-start |
sm, md, lg, xl | start |
d-{breakpoint}-items-end |
sm, md, lg, xl | end |
d-{breakpoint}-items-center |
sm, md, lg, xl | center |
d-{breakpoint}-baseline |
sm, md, lg, xl | baseline |
d-{breakpoint}-items-stretch |
sm, md, lg, xl | stretch |
d-sm-items-start
d-sm-items-start
d-sm-items-start
d-sm-items-end
d-sm-items-end
d-sm-items-end
d-sm-items-center
d-sm-items-center
d-sm-items-center
d-sm-items-baseline
d-sm-items-baseline
d-sm-items-baseline
d-sm-items-stretch
d-sm-items-stretch
d-sm-items-stretch
<div class="d-grid grid-col-2 d-sm-items-center"> <div>...</div> </div>
Align Self
Align self by adjusting the margin within its container along the cross axis.
Class value | Breakpoint | Align self |
---|---|---|
d-{breakpoint}-self-auto |
sm, md, lg, xl | auto |
d-{breakpoint}-self-start |
sm, md, lg, xl | start |
d-{breakpoint}-self-end |
sm, md, lg, xl | end |
d-{breakpoint}-self-flex-start |
sm, md, lg, xl | flex-start |
d-{breakpoint}-self-flex-end |
sm, md, lg, xl | flex-end |
d-{breakpoint}-self-center |
sm, md, lg, xl | center |
d-{breakpoint}-self-baseline |
sm, md, lg, xl | baseline |
d-{breakpoint}-self-stretch |
sm, md, lg, xl | stretch |
d-sm-self-auto
d-sm-self-start
d-sm-self-end
d-sm-self-center
d-sm-self-baseline
d-sm-self-stretch
<div class="d-grid grid-flow-col gap-1"> ... <div class="d-sm-self-center">...</div> ... </div>
Fixed Align
Class value | Property style |
---|---|
d-justify-start |
justify-content: start |
d-justify-flex-end |
justify-content: flex-end |
d-justify-end |
justify-content: end |
d-justify-center |
justify-content: center |
d-justify-between |
justify-content: space-between |
d-justify-around |
justify-content: space-around |
d-justify-evenly |
justify-content: space-evenly |
d-align-start |
justify-items: start |
d-align-end |
justify-items: end |
d-align-center |
justify-items: center |
d-align-stretch |
justify-items: stretch |
d-items-start |
align-items: start |
d-items-end |
align-items: end |
d-items-center |
align-items: center |
d-items-baseline |
align-items: baseline |
d-items-stretch |
align-items: stretch |
d-content-start |
align-content: start |
d-content-end |
align-content: end |
d-content-center |
align-content: center |
d-content-between |
align-content: space-between |
d-content-around |
align-content: space-around |
d-content-stretch |
align-content: stretch |
d-self-auto |
align-self: auto |
d-self-start |
align-self: start |
d-self-end |
align-self: end |
d-self-flex-start |
align-self: flex-start |
d-self-flex-end |
align-self: flex-end |
d-self-center |
align-self: center |
d-self-baseline |
align-self: baseline |
d-self-stretch |
align-self: stretch |
Float
Class value | Breakpoint | Float direction |
---|---|---|
float-{breakpoint}-left |
sm, md, lg, xl | left |
float-{breakpoint}-right |
sm, md, lg, xl | right |
float-{breakpoint}-none |
sm, md, lg, xl | none |
float-right |
- | right |
float-left |
- | left |
float-none |
- | none |
float-left
float-left
float-right
float-right
<div class="float-sm-right"> <div>...</div> <div>...</div> </div>
Clearfix
The clearfix
property clears the left and right side of the floating element.
Without Clearfix
float-right
With Clearfix
float-right
<div class="clearfix"> <div class="float-sm-right">...</div> ... </div>
Overflow
Use the overflow utility classes to control content that is larger than its container.
Class value | Breakpoint | Overflow style |
---|---|---|
overflow-{breakpoint}-visible |
sm, md, lg, xl | visible |
overflow-{breakpoint}-hidden |
sm, md, lg, xl | hidden |
overflow-{breakpoint}-auto |
sm, md, lg, xl | auto |
overflow-{breakpoint}-scroll |
sm, md, lg, xl | scroll |
overflow-visible |
- | visible |
overflow-hidden |
- | hidden |
overflow-auto |
- | auto |
overflow-scroll |
- | scroll |
Visible
Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla. Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh.Hidden
Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla. Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh.Auto
Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla. Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh.Scroll
Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla. Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh.<div class="overflow-sm-scroll"> <p>...</p> </div>
Position
Class value | Breakpoint | Position style |
---|---|---|
position-{breakpoint}-static |
sm, md, lg, xl | static |
position-{breakpoint}-relative |
sm, md, lg, xl | relative |
position-{breakpoint}-absolute |
sm, md, lg, xl | absolute |
position-{breakpoint}-fixed |
sm, md, lg, xl | fixed |
position-{breakpoint}-sticky |
sm, md, lg, xl | sticky |
position-static |
- | static |
position-relative |
- | relative |
position-absolute |
- | absolute |
position-fixed |
- | fixed |
position-sticky |
- | sticky |
Top, Right, Bottom & Left
Class value | Edge | Breakpoint | Position |
---|---|---|---|
{position}-{breakpoint}-0 |
top, right, bottom, left | sm, md, lg, xl | 0px |
{position}-{breakpoint}-auto |
top, right, bottom, left | sm, md, lg, xl | auto |
{position}-0 |
top, right, bottom, left | - | 0px |
{position}-auto |
top, right, bottom, left | - | auto |
position-absolute top-0
position-absolute bottom-0
position-absolute
top-0 right-0
bottom-0
<div class="position-relative"> <div class="position-absolute top-0">...</div> </div>
Z-index
The z-index property can be used to set the stack order of elements. The higher stack order number is always in front of the element with the lower stack order number.
Class value | Breakpoint | Stack order |
---|---|---|
zindex-{breakpoint}-00 |
sm, md, lg, xl | 1000 |
zindex-{breakpoint}-01 |
sm, md, lg, xl | 1020 |
zindex-{breakpoint}-02 |
sm, md, lg, xl | 1040 |
zindex-00 |
- | 1000 |
zindex-01 |
- | 1020 |
zindex-02 |
- | 1040 |
z-index 0
zindex-00
zindex-01
<div class="position-relative"> <div class="position-absolute zindex-01">...</div> </div>