CSS -rooster-sjabloon-kolomme Eiendom
Voorbeeld
Maak 'n roosterhouer met 4 kolomme:
.grid-container {
display: grid;
grid-template-columns:
auto auto auto auto;
}
Definisie en gebruik
Die grid-template-columns
eienskap spesifiseer die aantal (en die breedtes) van kolomme in 'n roosteruitleg.
Die waardes is 'n spasie-geskeide lys, waar elke waarde die grootte van die onderskeie kolom spesifiseer.
Standaard waarde: | geen |
---|---|
Geërf: | geen |
Animateerbaar: | ja. Lees oor animeerbaar |
Weergawe: | CSS Grid Uitleg Module Vlak 1 |
JavaScript-sintaksis: | objek .style.gridTemplateColumns="50px 50px 50px" |
Blaaierondersteuning
Die nommers in die tabel spesifiseer die eerste blaaierweergawe wat die eiendom ten volle ondersteun.
Property | |||||
---|---|---|---|---|---|
grid-template-columns | 57 | 16 | 52 | 10 | 44 |
CSS-sintaksis
grid-template-columns: none|auto|max-content|min-content|length|initial|inherit;
Eiendomswaardes
Value | Description | Play it |
---|---|---|
none | Default value. Columns are created if needed | |
auto | The size of the columns is determined by the size of the container and on the size of the content of the items in the column | |
max-content | Sets the size of each column to depend on the largest item in the column | |
min-content | Sets the size of each column to depend on the smallest item in the column | |
length | Sets the size of the columns, by using a legal length value. Read about length units | |
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
Maak 'n roosterhouer met 4 kolomme en spesifiseer 'n grootte vir elke kolom:
.grid-container {
display: grid;
grid-template-columns:
30px 200px auto 100px;
}
Verwante bladsye
CSS-tutoriaal: CSS-roosteruitleg
CSS-verwysing: Die rooster-sjabloon-rye- eienskap
CSS-verwysing: Die rooster-sjabloon- eienskap