bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths
Learn/CSS/Modern Layout
CSS•Modern Layout

CSS Grid Container

A grid container contains one or more grid items arranged in columns and rows.

All direct child elements of a grid container automatically become grid items.

An element becomes a grid container when its display property is set to grid or inline-grid .

Display Grid Property

The <div> element becomes a grid container when its display property is set to grid or inline-grid .

display: grid
display: inline-grid

CSS Grid Container Properties

PropertyDescription
align-contentVertically aligns the grid items inside the container
align-itemsSpecifies the default alignment for items inside a flexbox or grid container
displaySpecifies the display behavior (the type of rendering box) of an element
column-gapSpecifies the gap between the columns
gapA shorthand property for the row-gap and the column-gap properties
gridA shorthand property for the grid-template-rows, grid-template-columns, grid-template-areas, grid-auto-rows, grid-auto-columns , and the grid-auto-flow properties
grid-auto-columnsSpecifies a default column size
grid-auto-flowSpecifies how auto-placed items are inserted in the grid
grid-auto-rowsSpecifies a default row size
grid-templateA shorthand property for the grid-template-rows , grid-template-columns and grid-areas properties
grid-template-areasSpecifies how to display columns and rows, using named grid items
grid-template-columnsSpecifies the size of the columns, and how many columns in a grid layout
grid-template-rowsSpecifies the size of the rows in a grid layout
justify-contentHorizontally aligns the grid items inside the container
place-contentA shorthand property for the align-content and the justify-content properties
row-gapSpecifies the gap between the grid rows

Previous

CSS Flex Container

Next

Responsive Web Design - The Viewport

This chapter

Overview
24

Lessons

64m

Read time

1. CSS Flexbox2. CSS Grid Layout3. Responsive Web Design4. CSS Flex Container5. CSS Grid Container6. Responsive Web Design - The Viewport7. CSS Flexbox justify-content8. CSS Grid Tracks9. Responsive Web Design - Building a Grid View10. CSS Flexbox Align11. CSS Grid Gap12. Responsive Web Design - Media Queries13. CSS Flex Items14. CSS Grid Container - Align Grid Content15. Responsive Web Design - Images16. CSS Responsive Flexbox17. CSS Grid Items18. Responsive Web Design - Frameworks19. CSS Naming Grid Items20. Responsive Web Design - Templates21. CSS Grid Items - Alignment22. CSS Grid Items - Order23. CSS 12-Column Grid Layout24. CSS @supports Rule

On this page

Display Grid PropertyCSS Grid Container Properties