सीएसएस ग्रिड संपत्ति
उदाहरण
एक तीन कॉलम ग्रिड लेआउट बनाएं जहां पहली पंक्ति 150px ऊंची हो:
.grid-container {
display: grid;
grid: 150px
/ auto auto auto;
}
परिभाषा और उपयोग
संपत्ति के grid
लिए एक आशुलिपि संपत्ति है:
- ग्रिड-टेम्पलेट-पंक्तियाँ
- ग्रिड-टेम्पलेट-कॉलम
- ग्रिड-टेम्पलेट-क्षेत्र
- ग्रिड-ऑटो-पंक्तियाँ
- ग्रिड-ऑटो-कॉलम
- ग्रिड-ऑटो-फ्लो
डिफ़ॉल्ट मान: | कोई नहीं कोई नहीं कोई नहीं ऑटो ऑटो पंक्ति |
---|---|
विरासत में मिला: | नहीं |
एनिमेटेबल: | हाँ, व्यक्तिगत गुण देखें । एनिमेटेबल के बारे में पढ़ें |
संस्करण: | CSS ग्रिड लेआउट मॉड्यूल स्तर 1 |
जावास्क्रिप्ट सिंटैक्स: | ऑब्जेक्ट .style.grid="250px / ऑटो ऑटो ऑटो" |
ब्राउज़र समर्थन
तालिका में संख्याएं पहले ब्राउज़र संस्करण को निर्दिष्ट करती हैं जो पूरी तरह से संपत्ति का समर्थन करता है।
Property | |||||
---|---|---|---|---|---|
grid | 57 | 16 | 52 | 10 | 44 |
सीएसएस सिंटेक्स
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;
सम्पत्ति की कीमत
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 |
और ज्यादा उदाहरण
उदाहरण
दो पंक्तियों को निर्दिष्ट करें, जहां "आइटम 1" पहली दो पंक्तियों में पहले दो कॉलम (पांच कॉलम ग्रिड लेआउट में) फैलाता है:
.item1 {
grid-area: myArea;
}
.grid-container {
display: grid;
grid:
'myArea myArea . . .'
'myArea myArea . . .';
}
उदाहरण
सभी मदों को नाम दें, और एक उपयोग के लिए तैयार वेबपेज टेम्पलेट बनाएं:
.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';
}
संबंधित पृष्ठ
सीएसएस ट्यूटोरियल: सीएसएस ग्रिड कंटेनर
CSS संदर्भ: ग्रिड-टेम्पलेट-क्षेत्र गुण
CSS संदर्भ: ग्रिड-टेम्पलेट-पंक्तियाँ गुण
CSS संदर्भ: ग्रिड-टेम्पलेट-कॉलम गुण
CSS संदर्भ: ग्रिड-ऑटो-पंक्तियाँ गुण
CSS संदर्भ: ग्रिड-ऑटो-कॉलम गुण
CSS संदर्भ: ग्रिड-ऑटो-फ्लो गुण
सीएसएस संदर्भ: ग्रिड-पंक्ति-अंतराल संपत्ति
CSS संदर्भ: ग्रिड-कॉलम-गैप गुण