HTML CSS SQL SEO:Meta tag Generator

CSS grid-column

Introduction Syntax Selectors Attribute Selectors Specificity Combinators !important Comments Colors

CSS Need to Know

Box Model Pseudo-class Pseudo-element Inline-block Math Functions Max and Min Opacity Outline Overflow Z-index Float

Most used

Align Backgrounds Borders Text Units Padding Margins Position Tables Display Fonts Lists Height and Width

CSS Reference

CSS Properties reference CSS propertys reference CSS Pseudo-Elements reference CSS Selector reference

CSS grid-column

CSS grid-column

The grid-column property in CSS is used to specify the size of columns in a grid layout. It allows you to control the size and position of grid columns within a grid container.

Syntax:

grid-column: grid-start / grid-end

{grid-column: 1 / span 2;}
{grid-column: 1 / span 3;}
{grid-column: 2 / span 3;}
{grid-column: 2 / span 4;}
{grid-column: 3 / span 2;}

The grid-start and grid-end values specify the starting and ending positions of the grid column, which can be either a line number, a name, or a span of multiple lines.

Examples:

Result:
Column 1-2
Column 2-3

In this example, we have a grid container with 3 columns. The first div element spans from the first column to the third column using grid-column: 1 / 3;, and the second div element spans from the second column to the fourth column using grid-column: 2 / 4;.

You can also use span to specify the number of columns the grid item should span:

Result:
Column 2-4

This example shows a grid item that starts from the second column and spans 2 columns using grid-column: 2 / span 2;.