CSS grid-auto-columns Property
Description
The grid-auto-columns property defines the size that the grid will assign to any column tracks it has to create implicitly — in other words, columns that were not explicitly defined in the grid’s explicit track list. When content or placement causes the grid to grow beyond the columns you declared with your explicit template, the layout engine generates implicit columns and uses the sizing rules given by grid-auto-columns to determine how wide those tracks should be. This lets you control how additional columns behave without having to enumerate every possible column in your explicit template.
Implicit columns can be created in two main ways: by the auto-placement algorithm when items flow into new tracks, or by manual placement when an item is positioned outside the range of your explicit columns. The way auto-placement expands the grid (whether it tends to add rows or add columns) is governed by grid-auto-flow, so grid-auto-columns is particularly important when your flow can produce extra columns — it tells the engine what those extra columns should look like. If you manually place an item beyond the last explicit column, the grid will also create implicit columns sized by grid-auto-columns to accommodate that placement.
Implicit columns are treated separately from the explicit columns you define with grid-template-columns, but they still participate in the overall track sizing and intrinsic sizing process. For example, how an implicit column contributes to the grid’s intrinsic size or to item spanning depends on its computed size; if implicit columns are content-sized they may grow to fit their contents, which can affect alignment, overflow, and the distribution of space when items span explicit and implicit tracks. There is a corresponding property for implicitly-created rows, grid-auto-rows, and thinking of implicit tracks as a complement to your explicit template helps when designing layouts that must gracefully handle items placed beyond your initial grid definition.
Definition
- Initial value
- auto
- Applies to
- Grid containers
- Inherited
- No
- Computed value
- tThe percentage as specified or the absolute length
- Animatable
- Yes
- JavaScript syntax
- object.style.gridAutoColumns
Interactive Demo
Syntax
grid-auto-columns: <track-size>+ where <track-size> = <track-breadth> | minmax( <inflexible-breadth> , <track-breadth> ) | fit-content( [ <length> | <percentage> ] ) where <track-breadth> = <length-percentage> | <flex> | min-content | max-content | auto <inflexible-breadth> = <length> | <percentage> | min-content | max-content | auto where <length-percentage> = <length> | <percentage>
Values
- autoThe size of the columns is determined by the size of the container and the size of the contents of the elements in the column. As a maximum, it is identical to the value of max-content , but at least it represents the largest minimum size. Automatic column sizes can be stretched using align-content properties and justify-content. This is the default value.
- length / percentageSpecifies the size of implicitly created columns using a valid length value, or a percentage value. The value must be positive.
- flexNon-negative value in "flexible" units of measure fr ( fractional unit ). Each implicitly created column occupies a part of the remaining space in the container of the layout grid in proportion to the specified coefficient. For example, when using the value 1fr 2fr , implicitly created columns will occupy ⅓ and ⅔ of the remaining space, respectively. The total size of such rows or columns is subtracted from the available space, which gives the remaining space, which is then divided between the rows and columns of flexible size in proportion to their coefficient. Values between 0fr and 1fr have somewhat special behaviour, when the sum of the coefficients is less than 1, they will occupy less than 100% of the remaining space. When the available space is infinite (the width or height of the layout grid container is undefined), the size of the flexible grid columns is determined by their contents while maintaining the appropriate proportions.
- max-contentA keyword that sets the size of each column based on the largest item in the column.
- min-contentA keyword that sets the size of each column based on the smallest item in the column.
- minmax (min, max)Functional notation that defines a range of sizes greater than or equal to min and less than or equal to max . If max is less than min , then max is ignored, and the function is treated as min . The value in "flexible" units of measurement as the maximum value sets the coefficient of flexibility of the column, this is not acceptable for determining the minimum.
- fit-content (length | percentage)This is the formula min (max-content, max (auto, argument)) , which is calculated by analogy with auto (that is, minmax (auto, max-content) ), except that the size of the column is clamped by the argument value, if it is larger than the automatic minimum.
Example
Browser Support
The following information will show you the current browser support for the CSS grid-auto-columns property. Hover over a browser icon to see the version that first introduced support for this CSS property.
This property is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 1st January 2026
