Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

CSS grid-auto-columns property

CSS grid-auto-columns property

Example

Set the default size of columns in the grid::

.grid-container

{

display:

grid

;

grid-auto-columns:

50

px

;

}

Try it »


Browser support

The numbers in the table indicate the first browser version that supports this property.

property
grid-auto-columns 57 16 52 10 44

Property definition and usage

The grid-auto-columns property sets the default size of columns in a grid container.

This property only affects columns whose size is not set.

Default value: auto
Inherited: no
Animatable: support. Read about animatable Try it
Version: CSS Grid Layout Module Level 1
JavaScript syntax: object.style.gridAutoColumns="120px" Try it

Syntax

grid-auto-columns: auto|max-content|min-content|length;

Value Description
* auto * Default value. The column size is determined by the container size
fit-content() Equivalent to the formula min(max-content, max(auto, argument)), similar to the computation of auto (i.e., minmax(auto, max-content))
max-content Sets the size of each column based on the largest grid item in the column
min-content Sets the size of each column based on the smallest grid item in the column
minmax(min.max) Sets a value greater than or equal to min and less than or equal to max
length Uses a custom length value to set the column size.Read about length units
% Uses a percentage value to set the column size

Related Articles

CSS Tutorial: CSS Grid Layout

CSS Reference Manual: grid-auto-row property