CSS ızgarası Özellik
Örnek
İlk satırın 150 piksel yüksekliğinde olduğu üç sütunlu bir ızgara düzeni yapın:
.grid-container {
display: grid;
grid: 150px
/ auto auto auto;
}
Tanım ve Kullanım
Özellik grid
, aşağıdakiler için kestirme bir özelliktir:
- ızgara şablonu satırları
- ızgara-şablon-sütunları
- ızgara-şablon-alanları
- ızgara-otomatik satırlar
- ızgara-otomatik sütunlar
- ızgara-otomatik akış
Varsayılan değer: | hiçbiri hiçbiri hiçbiri otomatik otomatik satır |
---|---|
Miras: | Hayır |
canlandırılabilir: | evet, bireysel özelliklere bakın . Canlandırılabilir hakkında bilgi edinin |
Sürüm: | CSS Izgara Düzen Modülü Seviye 1 |
JavaScript sözdizimi: | nesne .style.grid="250 piksel / otomatik otomatik otomatik" |
Tarayıcı Desteği
Tablodaki sayılar, özelliği tam olarak destekleyen ilk tarayıcı sürümünü belirtir.
Property | |||||
---|---|---|---|---|---|
grid | 57 | 16 | 52 | 10 | 44 |
CSS Sözdizimi
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;
Mülk değerleri
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 |
Daha fazla örnek
Örnek
"item1" öğesinin ilk iki satırdaki ilk iki sütunu kapsadığı iki satır belirtin (beş sütunlu bir ızgara düzeninde):
.item1 {
grid-area: myArea;
}
.grid-container {
display: grid;
grid:
'myArea myArea . . .'
'myArea myArea . . .';
}
Örnek
Tüm öğeleri adlandırın ve kullanıma hazır bir web sayfası şablonu yapın:
.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';
}
İlgili Sayfalar
CSS Eğitimi: CSS Izgara Konteyneri
CSS Referansı: ızgara şablonu alanları özelliği
CSS Referansı: grid-template-rows özelliği
CSS Referansı: grid-template-columns özelliği
CSS Referansı: grid-auto-rows özelliği
CSS Referansı: grid-auto-columns özelliği
CSS Referansı: grid-auto-flow özelliği
CSS Referansı: Grid-row-boşluk özelliği
CSS Referansı: grid-column-gap özelliği