Flexbox & GridGrid Auto Columns

Grid Auto Columns

Controls the size of grid columns created implicitly.

Widely available

This feature is well established and works across many devices and browser versions.

Chrome
Edge
Firefox
Safari
ClassStyle
gac-autogrid-auto-columns: auto;
gac-maxgrid-auto-columns: max-content;
gac-mingrid-auto-columns: min-content;

Auto

Initial value

The columns will size themselves based on the content and available space in the grid container.

Sphinx of black quartz, judge my vow.
B
C
<div class="d-g gac-auto g-4 gtr-auto">
<div class="ai-c bg-indigo d-f jc-c p-4 tc-white">Sphinx of black quartz, judge my vow.</div>
<div class="ai-c bg-indigo-8 d-f jc-c p-4 tc-indigo-5">B</div>
<div class="ai-c bg-indigo-8 d-f jc-c p-4 tc-indigo-5">C</div>
</div>

Min Content

The columns will size themselves to the smallest possible width that does not cause overflow.

Sphinx of black quartz, judge my vow.
B
C
<div class="d-g gac-min g-4 gtr-auto">
<div class="ai-c bg-indigo d-f jc-c p-4 tc-white">Sphinx of black quartz, judge my vow.</div>
<div class="ai-c bg-indigo-8 d-f jc-c p-4 tc-indigo-5">B</div>
<div class="ai-c bg-indigo-8 d-f jc-c p-4 tc-indigo-5">C</div>
</div>

Max Content

The columns will size themselves to the largest possible width based on their content.

Sphinx of black quartz, judge my vow.
B
C
<div class="d-g gac-max g-4 gtr-auto">
<div class="ai-c bg-indigo d-f jc-c p-4 tc-white">Sphinx of black quartz, judge my vow.</div>
<div class="ai-c bg-indigo-8 d-f jc-c p-4 tc-indigo-5">B</div>
<div class="ai-c bg-indigo-8 d-f jc-c p-4 tc-indigo-5">C</div>
</div>

Using utility variants

Learn how to override existing utilities based on the user's screen size or other factors, such as hover states.

Targeting different viewports

You can combine responsive breakpoints like sm:gac-*, md:gac-*, lg:gac-*, and xxl:gac-* to allow targeting specific utilities in different viewports.

Targeting hover states

Alternatively, you can apply :hover by using h:gac-* utility to override elements and change their values when hovering over them.