Using CSS3 I can individually set the flex properties like so
.someclass {
flex-grow: 1;
flex-shrink: 1;
flex-basis: auto;
}
Using Bootstrap (version >= 4.1) flex it seems I can only set flex-grow-X and flex-shrink-X, like so
<div class="someclass flex-grow-1 flex-shrink-1">...</div>
Is there are way to set the flex-basis using bootstrap 4.1?
Flexbox. The biggest difference between Bootstrap 3 and Bootstrap 4 is that Bootstrap 4 now uses flexbox, instead of floats, to handle the layout. The Flexible Box Layout Module, makes it easier to design flexible responsive layout structure without using float or positioning.
Flexbox is a one-dimensional layout method for arranging items in rows or columns. Items flex (expand) to fill additional space or shrink to fit into smaller spaces.
Flex Start positions element at the start of the page. Flex End sets the element to the end of the page. Space Around arranges the items evenly but with spaces between them. The spaces will be equal among all the elements inside a flex-box container, but not outside them.
The flex-basis property is a sub-property of the Flexible Box Layout module. It specifies the initial size of the flex item, before any available space is distributed according to the flex factors. When omitted from the flex shorthand, its specified value is the length zero.
Looking at the source code of Bootstrap v4.1, there are no utility classes included that specifically target the flex-basis
value.
Searching through the file, there are only 12 occurances of the word flex-basis
:
flex-basis
to 0
for some of the col-*
classes (e.g. line 625).navbar
related classes (e.g. line 4268).This also seem to remain the case in the latest versions of Bootstrap at the time of this writing:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With