You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 13, 2025. It is now read-only.
A grid consists of a group of cells, which get positioned in sequence according to a predefined number of columns.
45
-
Cells specify how many columns to span (the default being 4), and get placed side by side while there is room. When
46
-
there isn't enough room for a cell, it gets moved to the beginning of the next row, and placement continues as usual.
44
+
A grid is a container that consists of a group of cells. Grid can define its own max-width or designate its columns to be a certain width. Cells get positioned in sequence according to a predefined number of columns.
47
45
48
46
The grid has 12 columns in desktop mode (>= 840px), 8 columns in tablet mode (>= 480px), and 4 columns in phone mode
49
-
(< 480px). Column widths are variable; margins and gutters are fixed, with columns taking up the remainder of the space.
47
+
(< 480px). Cells specify how many columns to span (the default is 4). Cells are placed side by side until there is no more room, then the next cell is placed at the beginning of the next row.
50
48
51
-
Margins (the space between the edge of the grid and the edge of the first cell) and gutters (the space between edges of adjacent cells) can be customized on different devices respectively based on design needs. Layout grids set default margins and gutters to 24px on desktop, 16px on tablet and phone, according to the Material Design spec.
49
+
Margins (the space between the edge of the grid and the edge of the first cell) and gutters (the space between edges of adjacent cells) can be customized on different devices respectively based on design needs. The columns are evenly distributed within the container width, minus the width of all margins and gutters. Layout grids set default margins and gutters to 24px on desktop, 16px on tablet and phone, according to the Material Design spec.
52
50
53
51
The grid and cells are not styled in any way, serving only for alignment and positioning of elements.
54
52
@@ -67,6 +65,8 @@ The grid and cells are not styled in any way, serving only for alignment and pos
67
65
68
66
The grid should have the `mdc-layout-grid` class. Every cell should have the `mdc-layout-grid__cell` class and must be wrapped by `mdc-layout-grid__inner` for proper alignment. Behavior for grids containing direct children without the `mdc-layout-grid__cell` class is undefined.
69
67
68
+
By default, `mdc-layout-grid` behaves like a fluid container, which takes up its parents container's available space. You can change the behavior using [max-width](#max-width) or [fixed column width layout grid](#fixed-column-width-grid).
69
+
70
70
71
71
### Margins and gutters
72
72
@@ -137,6 +137,26 @@ columns wide.
137
137
MDC layout grids take up the parent element space by default. However, user can set `$mdc-layout-grid-max-width` to restrict the max-width of the layout grid.
138
138
139
139
140
+
### Fixed column width grid
141
+
142
+
You can designate each column to have a certain width by using `mdc-layout-grid--fixed-column-width` modifier. The column width can be specified through sass map `$mdc-layout-grid-column-width` or css custom properties `--mdc-layout-grid-column-width-{screen_size}`. The column width is set to 72px on all devices by default.
When your contents need extra structure that cannot be supported by single layout grid, you can nest layout grid within each other. To nest layout grid, add a new `mdc-layout-grid__inner` to wrap around nested `mdc-layout-grid__cell` within an existing `mdc-layout-grid__cell`.
@@ -160,7 +180,6 @@ However, Material guideline do not recommend have a deeply nested grid since it
160
180
</div>
161
181
```
162
182
163
-
164
183
### Reordering
165
184
166
185
By default, items are positioned in the source order. However, you can reorder them by using the
@@ -235,6 +254,18 @@ behavior by using one of the `mdc-layout-grid__cell--align-{position}` alignment
235
254
236
255
> Note even though size is passed in as one of the arguments, it won't apply any `media-query` rules. It is set for using the correct CSS custom properties to overriden the margin and gutter at runtime (See [Margins and gutters](#margins-and-gutters) section for detail).
0 commit comments