CSS rooster Eiendom
Voorbeeld
Maak 'n driekolomme-roosteruitleg waar die eerste ry 150px hoog is:
.grid-container {
display: grid;
grid: 150px
/ auto auto auto;
}
Definisie en gebruik
Die grid
eiendom is 'n snelskrif eiendom vir:
- rooster-sjabloon-rye
- rooster-sjabloon-kolomme
- rooster-sjabloon-areas
- rooster-outo-rye
- rooster-outo-kolomme
- rooster-outo-vloei
Standaard waarde: | geen geen geen outomatiese outomatiese ry |
---|---|
Geërf: | geen |
Animateerbaar: | ja, sien individuele eiendomme . Lees oor animeerbaar |
Weergawe: | CSS Grid Uitleg Module Vlak 1 |
JavaScript-sintaksis: | object .style.grid="250px / outo outo outo" |
Blaaierondersteuning
Die nommers in die tabel spesifiseer die eerste blaaierweergawe wat die eiendom ten volle ondersteun.
Property | |||||
---|---|---|---|---|---|
grid | 57 | 16 | 52 | 10 | 44 |
CSS-sintaksis
grid: none|grid-template-rows /
grid-template-columns|grid-template-areas|grid-template-rows
/ [grid-auto-flow] grid-auto-columns|[grid-auto-flow] grid-auto-rows / grid-template-columns|initial|inherit;
Eiendomswaardes
Value | Description | Play it |
---|---|---|
none | Default value. No specific sizing of the columns or rows | |
grid-template-rows / grid-template-columns | Specifies the size(s) of the columns and rows | |
grid-template-areas | Specifies the grid layout using named items | |
grid-template-rows / grid-auto-columns | Specifies the size (height) of the rows, and the auto size of the columns | |
grid-auto-rows / grid-template-columns | Specifies the auto size of the rows, and sets the grid-template-columns property | |
grid-template-rows / grid-auto-flow grid-auto-columns | Specifies the size (height) of the rows, and how to place auto-placed items, and the auto size of the columns | |
grid-auto-flow grid-auto-rows / grid-template-columns | Specifies how to place auto-placed items, and the auto size of the rows, and sets the grid-template-columns property | |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
Meer voorbeelde
Voorbeeld
Spesifiseer twee rye, waar "item1" oor die eerste twee kolomme in die eerste twee rye strek (in 'n vyf kolomme roosteruitleg):
.item1 {
grid-area: myArea;
}
.grid-container {
display: grid;
grid:
'myArea myArea . . .'
'myArea myArea . . .';
}
Voorbeeld
Noem alle items en maak 'n gereed-vir-gebruik webblad-sjabloon:
.item1 { grid-area: header; }
.item2 { grid-area:
menu; }
.item3 { grid-area:
main; }
.item4 { grid-area:
right; }
.item5 { grid-area:
footer; }
.grid-container {
display: grid;
grid:
'header header header header header'
'menu main main main right right'
'menu footer footer
footer footer';
}
Verwante bladsye
CSS Tutoriaal: CSS Grid Container
CSS-verwysing: Die rooster-sjabloon-areas eiendom
CSS-verwysing: Die rooster-sjabloon-rye- eienskap
CSS-verwysing: Die rooster-sjabloon-kolomme- eienskap
CSS-verwysing: Die rooster-outo-rye- eienskap
CSS-verwysing: Die rooster-outo-kolomme- eienskap
CSS-verwysing: Die rooster-outovloei- eienskap
CSS-verwysing: Die rooster-ry-gaping eiendom
CSS-verwysing: Die rooster-kolom-gaping eiendom