सीएसएस ग्रिड लेआउट मॉड्यूल
हैडर
मेन्यू
मुख्य
सही
फ़ुटबाल
जाली का नक्शा
CSS ग्रिड लेआउट मॉड्यूल पंक्तियों और स्तंभों के साथ एक ग्रिड-आधारित लेआउट सिस्टम प्रदान करता है, जिससे फ़्लोट्स और पोजिशनिंग का उपयोग किए बिना वेब पेजों को डिज़ाइन करना आसान हो जाता है।
ब्राउज़र समर्थन
ग्रिड गुण सभी आधुनिक ब्राउज़रों में समर्थित हैं।
57.0 | 16.0 | 52.0 | 10 | 44 |
ग्रिड तत्व
ग्रिड लेआउट में एक या अधिक चाइल्ड तत्वों के साथ एक मूल तत्व होता है।
उदाहरण
<div
class="grid-container">
<div class="grid-item">1</div>
<div
class="grid-item">2</div>
<div class="grid-item">3</div>
<div class="grid-item">4</div>
<div
class="grid-item">5</div>
<div class="grid-item">6</div>
<div class="grid-item">7</div>
<div
class="grid-item">8</div>
<div class="grid-item">9</div>
</div>
1
2
3
4
5
6
7
8
9
संपत्ति प्रदर्शित करें
एक HTML तत्व एक ग्रिड कंटेनर बन जाता है जब उसकी display
संपत्ति
grid
या पर सेट होती है inline-grid
।
उदाहरण
.grid-container {
display: grid;
}
उदाहरण
.grid-container {
display: inline-grid;
}
ग्रिड कंटेनर के सभी प्रत्यक्ष बच्चे स्वचालित रूप से ग्रिड आइटम बन जाते हैं ।
ग्रिड कॉलम
ग्रिड मदों की लंबवत रेखाओं को कॉलम कहा जाता है ।
ग्रिड पंक्तियाँ
ग्रिड मदों की क्षैतिज रेखाओं को पंक्तियाँ कहा जाता है ।
ग्रिड अंतराल
प्रत्येक कॉलम/पंक्ति के बीच के रिक्त स्थान को गैप कहा जाता है ।
आप निम्न में से किसी एक गुण का उपयोग करके अंतराल के आकार को समायोजित कर सकते हैं:
grid-column-gap
grid-row-gap
grid-gap
उदाहरण
grid-column-gap
गुण स्तंभों के बीच का अंतर निर्धारित करता है :
.grid-container {
display: grid;
grid-column-gap: 50px;
}
उदाहरण
grid-row-gap
संपत्ति पंक्तियों के बीच का अंतर निर्धारित करती है :
.grid-container {
display: grid;
grid-row-gap: 50px;
}
उदाहरण
संपत्ति और संपत्तियों के
लिए grid-gap
एक आशुलिपि संपत्ति है
:grid-row-gap
grid-column-gap
.grid-container {
display: grid;
grid-gap: 50px 100px;
}
उदाहरण
संपत्ति का grid-gap
उपयोग पंक्ति अंतराल और स्तंभ अंतराल दोनों को एक मान में सेट करने के लिए भी किया जा सकता है:
.grid-container {
display: grid;
grid-gap: 50px;
}
ग्रिड लाइन्स
स्तम्भों के बीच की रेखाओं को स्तम्भ रेखाएँ कहते हैं ।
पंक्तियों के बीच की रेखाओं को पंक्ति रेखाएँ कहते हैं ।
ग्रिड आइटम को ग्रिड कंटेनर में रखते समय लाइन नंबर देखें:
उदाहरण
कॉलम लाइन 1 पर एक ग्रिड आइटम रखें और इसे कॉलम लाइन 3 पर समाप्त होने दें:
.item1 {
grid-column-start: 1;
grid-column-end: 3;
}
उदाहरण
पंक्ति पंक्ति 1 पर एक ग्रिड आइटम रखें और इसे पंक्ति पंक्ति 3 पर समाप्त होने दें:
.item1 {
grid-row-start: 1;
grid-row-end: 3;
}
सभी सीएसएस ग्रिड गुण
Property | Description |
---|---|
column-gap | Specifies the gap between the columns |
gap | A shorthand property for the row-gap and the column-gap properties |
grid | A shorthand property for the grid-template-rows, grid-template-columns, grid-template-areas, grid-auto-rows, grid-auto-columns, and the grid-auto-flow properties |
grid-area | Either specifies a name for the grid item, or this property is a shorthand property for the grid-row-start, grid-column-start, grid-row-end, and grid-column-end properties |
grid-auto-columns | Specifies a default column size |
grid-auto-flow | Specifies how auto-placed items are inserted in the grid |
grid-auto-rows | Specifies a default row size |
grid-column | A shorthand property for the grid-column-start and the grid-column-end properties |
grid-column-end | Specifies where to end the grid item |
grid-column-gap | Specifies the size of the gap between columns |
grid-column-start | Specifies where to start the grid item |
grid-gap | A shorthand property for the grid-row-gap and grid-column-gap properties |
grid-row | A shorthand property for the grid-row-start and the grid-row-end properties |
grid-row-end | Specifies where to end the grid item |
grid-row-gap | Specifies the size of the gap between rows |
grid-row-start | Specifies where to start the grid item |
grid-template | A shorthand property for the grid-template-rows, grid-template-columns and grid-areas properties |
grid-template-areas | Specifies how to display columns and rows, using named grid items |
grid-template-columns | Specifies the size of the columns, and how many columns in a grid layout |
grid-template-rows | Specifies the size of the rows in a grid layout |
row-gap | Specifies the gap between the grid rows |