Skip to content

Repository files navigation

CssGrids

Outline

  1. Overview.

  2. Terminology.

  3. Propterties.

    1.grid-template-rows. 2.grid-template-columns. 3.grid-row-gap. 4.grid-column-gap. 5.grid-gap. 6.fr 7.grid-row-start. 8.grid-row-end. 9.grid-column-start. 10.grid-column-end. 11.grid-row. 12.grid-column. 13.grid-area.

  4. Grid Naming

  5. Implicit vs Explicit grid.

  6. Links

Overview

  1. Bidirectional layout control.

  2. Content -> item -> self.

    1.{prefix}-content : @container-level aligns the whole container. 2.{prefix}-item : @container-level aligns container children. 1.{prefix}-self : @item-level overrides container derived alignment.

Terminology

Grid Containerdisplay:grid1. All direct children become grid items
Column Axis : positive y
Row Axis: positive x
Grid lines1.numbered for row and col
Grid track1.space between two grid lines i.e row and column
Gutter1.space between rows or colums

Propterties

  1. units can be mixed.
  2. Percentage as unit will not take gutters into consideration.
  3. Multiple grid items can be in same cell. Manipulation with z-index.
  4. Negative values starts from reverse order. i.e -1 i last.
  5. fr will fill up remaining space but is never smaller than min-content.
PropertyDescription
1grid-template-rows :x unit y unit2 rows with specified width
2grid-template-rows : x unit y unit2 rows with specified width
3grid-template-rows : repeat(number, x unit) y unitn +1 rows with specified width
4grid-template-colums : x unit y unit2 columns with specified width
5grid-template-colums :repeat(number, x unit) 1frn+1 columns with specified width and last column spans remaining space
6grid-template-colums :repeat(number, 1fr)n columns equal width
7grid-row-gap: x unitrow gutter
8grid-column-gap: y unitcolumn gutter
9grid-gap: x unitrow-column gutter
---
MOVING GRID ITEMS
---
10grid-row-start: row numbermove to row
11grid-row-end: row numbercell end at before this row
12grid-column-start: column numberrow-column gutter
13grid-column-end: column numberrow-column gutter
14grid-row: number / numberrow-column gutter
15grid-column: number / numberrow-column gutter
16grid-area: number / number / number / numberrow-column gutter
---
IMPLICIT GRID
---
19grid-auto-flow: row/column densegrid overflow paradigm, dense removes empty cells
20grid-auto-rows: x unitsheight of implicit grid cells row overflow
20grid-auto-columns: x unitsheight of implicit grid cells column overflow
---
SPANNIG GRID ITEMS
---
17grid-row: number /span number
18grid-column: number /negative number
---
ALIGN GRID ITEMS
---
align-items: stringalign across column axis.@container level
justify-items: stringalign across row axis.@container level
align-self: stringoverride align items.@item level
justify-self: stringoverride justigy items.@item level
---
ALIGN GRID TRACKS
justify-content: stringalign across row axis.@container level
align-content: stringalign across column axis.@container level
---
align-items: stringalign across column axis.@container level
NAMING GRID
---
grid-template-areas: gigantic syntax refer mdn
---
CONTENT BASEDPROPERTY VALUES
max-contentmaximum dimension without linebreak
min-contentminimum dimension without overflow
minmax(min, max)dimension range
---
AUTOFILL & AUTO FIT
grid-template-columns:repeat(autofill, width)creates tracks of width and fills the container with available items and rest are empty
grid-template-columns:repeat(autofit, width)creates tracks of width and fills the container with available items and rest are empty and collapsed.

CSS Grid CheatSheet

Grid Naming

Grid Lines Naming

  1. In repeat common name results in a NAMESET in a format "[name] number".

Grid Area Naming

  1. In repeat common name results in a NAMESET in a format "[name] number".

Implicit vs Explicit grids.

Links

1.Basic page Layout Codepen

CSS Layout


2.Page Layout GridArea Codepen

CSS Layout

3.Grid min max content code pen

forward content.

  1. Grid placement algorithm.
  2. Subgrid
  3. extend vs mixin

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages