CSS grid-template-columns Özellik
Örnek
4 sütunlu bir ızgara kabı yapın:
.grid-container {
display: grid;
grid-template-columns:
auto auto auto auto;
}
Tanım ve Kullanım
Özellik grid-template-columns
, bir ızgara düzenindeki sütunların sayısını (ve genişliklerini) belirtir.
Değerler, her değerin ilgili sütunun boyutunu belirttiği boşlukla ayrılmış bir listedir.
Varsayılan değer: | Yok |
---|---|
Miras: | Hayır |
canlandırılabilir: | Evet. Canlandırılabilir hakkında bilgi edinin |
Sürüm: | CSS Izgara Düzen Modülü Seviye 1 |
JavaScript sözdizimi: | nesne .style.gridTemplateColumns="50px 50px 50px" |
Tarayıcı Desteği
Tablodaki sayılar, özelliği tam olarak destekleyen ilk tarayıcı sürümünü belirtir.
Property | |||||
---|---|---|---|---|---|
grid-template-columns | 57 | 16 | 52 | 10 | 44 |
CSS Sözdizimi
grid-template-columns: none|auto|max-content|min-content|length|initial|inherit;
Mülk değerleri
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 |
Daha fazla örnek
Örnek
4 sütunlu bir ızgara kabı yapın ve her sütun için bir boyut belirtin:
.grid-container {
display: grid;
grid-template-columns:
30px 200px auto 100px;
}
İlgili Sayfalar
CSS Eğitimi: CSS Izgara Düzeni
CSS Referansı: grid-template-rows özelliği
CSS Referansı: ızgara şablonu özelliği