What is Bootstrap Flex ?
Rapidly deal with the design, arrangement, and measuring of lattice sections, route, segments, and more with a full set-up of responsive flexbox utilities.
Empower Bootstrap flex practices
Apply display utilities to make a flexbox holder and transform direct youngsters elements into flex things. Flex holders and things can be changed further with extra flex properties.
Syntax:-
flexbox container
<div class=”d-flex p-2 bd-highlight”>I’m a flexbox container!</div>
Syntax:-
inline flexbox container
<div class=”d-inline-flex p-2 bd-highlight”>I’m an inline flexbox container!</div>
Responsive variations .d-flex and .d-inline-flex.
.d-flex
.d-inline-flex
.d-sm-flex
.d-sm-inline-flex
.d-md-flex
.d-md-inline-flex
.d-lg-flex
.d-lg-inline-flex
.d-xl-flex
.d-xl-inline-flex
Direction
We can set the course of flex things in a flex holder with bearing utilities. Much of the time you can discard the flat class here as the program default is line. Be that as it may, you may experience circumstances where you expected to unequivocally set this worth (like responsive designs).
We can Use
.flex-line to set a flat heading (the program default).
.flex-line reverse to start the flat heading from the contrary side.
Example:-
<div class=”d-flex flex-row bd-highlight mb-3″> <div class=”p-2 bd-highlight”>Flex item 1</div> <div class=”p-2 bd-highlight”>Flex item 2</div> <div class=”p-2 bd-highlight”>Flex item 3</div> </div> <div class=”d-flex flex-row-reverse bd-highlight”> <div class=”p-2 bd-highlight”>Flex item 1</div> <div class=”p-2 bd-highlight”>Flex item 2</div> <div class=”p-2 bd-highlight”>Flex item 3</div> </div>
Use .flex-column to set a vertical course, or .flex-section reverse to start the vertical heading from the contrary side.
Example:-
<div class=”d-flex flex-column bd-highlight mb-3″> <div class=”p-2 bd-highlight”>Flex item 1</div> <div class=”p-2 bd-highlight”>Flex item 2</div> <div class=”p-2 bd-highlight”>Flex item 3</div> </div> <div class=”d-flex flex-column-reverse bd-highlight”> <div class=”p-2 bd-highlight”>Flex item 1</div> <div class=”p-2 bd-highlight”>Flex item 2</div> <div class=”p-2 bd-highlight”>Flex item 3</div> </div>
Let’s see Responsive variations for flex-direction.
.flex-row
.flex-row-reverse
.flex-column
.flex-column-reverse
.flex-sm-row
.flex-sm-row-reverse
.flex-sm-column
.flex-sm-column-reverse
.flex-md-row
.flex-md-row-reverse
.flex-md-column
.flex-md-column-reverse
.flex-lg-row
.flex-lg-row-reverse
.flex-lg-column
.flex-lg-column-reverse
.flex-xl-row
.flex-xl-row-reverse
.flex-xl-column
.flex-xl-column-reverse
Justify content
Use justify-content utilities on flexbox holders to change the arrangement of flex things on the fundamental pivot (the x-hub to begin, y-hub if flex-heading: segment). Pick from start (browser default), end, center, between, or around.
Example:-
<div class=”d-flex justify-content-start”>Menu1</div> <div class=”d-flex justify-content-end”>Menu2</div> <div class=”d-flex justify-content-center”>Menu3</div> <div class=”d-flex justify-content-between”>Menu4</div> <div class=”d-flex justify-content-around”>Menu5</div>
Responsive variations for justify-content.
.justify-content-start
.justify-content-end
.justify-content-center
.justify-content-between
.justify-content-around
.justify-content-sm-start
.justify-content-sm-end
.justify-content-sm-center
.justify-content-sm-between
.justify-content-sm-around
.justify-content-md-start
.justify-content-md-end
.justify-content-md-center
.justify-content-md-between
.justify-content-md-around
.justify-content-lg-start
.justify-content-lg-end
.justify-content-lg-center
.justify-content-lg-between
.justify-content-lg-around
.justify-content-xl-start
.justify-content-xl-end
.justify-content-xl-center
.justify-content-xl-between
.justify-content-xl-around
Align items
Use align-items utilities on flexbox compartments to change the arrangement of flex things on the cross hub (the y-pivot to begin, x-hub if flex-bearing: segment).
Example:-
<div class=”d-flex align-items-start”>Item1</div> <div class=”d-flex align-items-end”>Item2</div> <div class=”d-flex align-items-center”>Item3</div> <div class=”d-flex align-items-baseline”>Item4</div> <div class=”d-flex align-items-stretch”>Item5</div>
Responsive variations for align-items.
.align-items-start
.align-items-end
.align-items-center
.align-items-baseline
.align-items-stretch
.align-items-sm-start
.align-items-sm-end
.align-items-sm-center
.align-items-sm-baseline
.align-items-sm-stretch
.align-items-md-start
.align-items-md-end
.align-items-md-center
.align-items-md-baseline
.align-items-md-stretch
.align-items-lg-start
.align-items-lg-end
.align-items-lg-center
.align-items-lg-baseline
.align-items-lg-stretch
.align-items-xl-start
.align-items-xl-end
.align-items-xl-center
.align-items-xl-baseline
.align-items-xl-stretch
Align self
We can Use adjust self utilities on flexbox things to separately change their arrangement on the cross hub (the y-hub to begin, x-hub if flex-bearing: segment).
Example:-
<div class=”align-self-start”>Aligned flex item</div> <div class=”align-self-end”>Aligned flex item</div> <div class=”align-self-center”>Shift flex item</div> <div class=”align-self-baseline”>Shift flex item</div> <div class=”align-self-stretch”>Aligned flex item</div>
Grow and shrink
We can Use .flex-develop * utilities to flip a flex thing’s capacity to develop to occupy accessible space. In the model underneath, the .flex-grow-1 components utilizes all accessible space it can, while permitting the staying two flex things their vital space.
Example:-
<div class=”d-flex bd-highlight”> <div class=”p-2 flex-grow-1 bd-highlight”>Flex item</div> <div class=”p-2 bd-highlight”>Flex item</div> <div class=”p-2 bd-highlight”>Third flex item</div> </div>
Auto margins
Flexbox can do some quite magnificent things when you blend flex arrangements with auto edges.
Example:-
<div class=”d-flex bd-highlight mb-3″> <div class=”p-2 bd-highlight”>Flex item</div> <div class=”p-2 bd-highlight”>……….</div> <div class=”p-2 bd-highlight”>Flex item</div> </div>
<div class=”d-flex bd-highlight mb-3″> <div class=”mr-auto p-2 bd-highlight”>Flex item</div> <div class=”p-2 bd-highlight”>………</div> <div class=”p-2 bd-highlight”>Flex item</div> </div>
<div class=”d-flex bd-highlight mb-3″> <div class=”p-2 bd-highlight”>Flex item</div> <div class=”p-2 bd-highlight”>………</div> <div class=”ml-auto p-2 bd-highlight”>Flex item</div> </div>
Comments