Autofit

Row

Make content expand to fill remaining space or create equally spaced content with .autofit-row, .autofit-col, .autofit-col-shrink, and .autofit-col-expand.

Warning .autofit-row, .autofit-col, .autofit-col-shrink, and .autofit-col-expand shouldn’t be used for laying out site pages, rather it’s most useful for small chunks of content inside other components (e.g. cards or list-groups).
Warning Direct descendants of .autofit-col are flex-direction: column; (IE 10-11 workaround because they don’t respect min/max width or min/max height in flex items) become block level elements by default, see https://www.w3.org/TR/css-flexbox-1/#flex-items If you want to display content inside .autofit-col using floats, inline, or inline-block, wrap the content with .autofit-section.

Snippet

Snippet

Autofit Col Shrink

The modifier autofit-col-shrink makes the column only as wide as its content and will grow to fill the remaining space depending on the length of the content. This should be used with variable width content such as title text with adjoining buttons.

Collection

ReallySuperInsanelyJustIncrediblyLongAndTotallyNotPossibleWordButWeAreReallyTryingToCoverAllOurBasesHereJustInCaseSomeoneIsNutsAsPerUsual

Autofit Col Expand

The modifier autofit-col-expand makes the column fill the remaining space.

Collection

ReallySuperInsanelyJustIncrediblyLongAndTotallyNotPossibleWordButWeAreReallyTryingToCoverAllOurBasesHereJustInCaseSomeoneIsNutsAsPerUsualSept 25 - 3 Views

Snippet

Spacing

The autofit-padded class should be added to autofit-row to give padding to all autofit-cols that are direct children of autofit-row.

The autofit-padded-no-gutters-x class gives padding to all autofit-cols that are direct children of autofit-row. It has negative margins on the left and right to offset the padding (similar to Bootstrap’s row class).

The autofit-padded-no-gutters-y class gives padding to all autofit-cols that are direct children of autofit-row. It has negative margins on the top and bottom to offset the padding (Generally used if nesting .autofit-row).

The autofit-padded-no-gutters class gives padding to all autofit-cols that are direct children of autofit-row. It has negative margins on the top, right, bottom, and left to offset the padding (Generally used if nesting .autofit-row).

Row Vertical Alignment

Autofit Row vertically aligns to the top by default.

The autofit-row-center class vertically aligns items in autofit-row to the middle.

The autofit-row-end class vertically aligns items in autofit-row to the bottom.

Float

The component autofit-float or .autofit-float-{sm|md}-down simulates the behavior of floated elements in .autofit-row. Items that break to a new line will be aligned to the left.

This pattern provides the benefit of aligning content via flexbox without losing the behavior of floated elements at the expense of extra markup.

ReallySuperInsanelyJustIncrediblyLongAndTotallyNotPossibleWordButWeAreReallyTryingToCoverAllOurBasesHereJustInCaseSomeoneIsNutsAsPerUsual

ReallySuperInsanelyJustIncrediblyLongAndTotallyNotPossibleWord

Snippet

Float End

Mimic “right floated” elements.

The component .autofit-float-end or .autofit-float-end-{sm|md}-down simulates the behavior of “right floated” elements in .autofit-row. Items that break to a new line will be aligned right.

Aligning items to the left will require nesting autofit-float autofit-row inside an autofit-col autofit-col-expand with the use of helper classes.

autofit-float-end uses justify-content: flex-end; to force right alignment. Any column that doesn’t expand the full width of autofit-row will be aligned right when it breaks to new line. Aligning items to the left will require nesting autofit-float autofit-row inside an autofit-col autofit-col-expand with the use of helper classes.

ReallySuperInsanelyJustIncrediblyLongAndTotallyNotPossibleWordButWeAreReallyTryingToCoverAllOurBasesHereJustInCaseSomeoneIsNutsAsPerUsual

ReallySuperInsanelyJustIncrediblyLongAndTotallyNotPossibleWord

Snippet

Float with Autofit Col End

Another way to mimic “right floated” elements without using autofit-float-end and autofit-col-expand. This pattern can duplicate floated layouts without the need for a clearfix.

Snippet

Nesting Autofit Rows

COMMENTS

LC
DA

Percolator beans french press extraction seasonal grinder plunger pot caramelization. Single origin, dark grinder cultivar aftertaste iced skinny cappuccino irish barista aftertaste fair trade.Sweet, carajillo decaffeinated, french press crema froth and organic a fair trade. In est cream brewed bar roast filter americano turkish.

LC

Percolator beans french press extraction seasonal grinder plunger pot caramelization. Single origin, dark grinder cultivar aftertaste iced skinny cappuccino irish barista aftertaste fair trade.Sweet, carajillo decaffeinated, french press crema froth and organic a fair trade. In est cream brewed bar roast filter americano turkish.

Snippet

Edit this page on GitHub

Contributors

Matuzalém Teles

Last edited May 9, 2025 at 6:15:38 AM