စီစဥ်ရာတွင် grid အကျယ်
定义和用法
grid 属性是以下属性的简写属性:
- grid-template-rows
- grid-template-columns
- grid-template-areas
- grid-auto-rows
- grid-auto-columns
- grid-auto-flow
အခြား ကြည့်ရန်
CSS 教程:CSS နေရာခွဲ အရာ
实例
例子 1
制作一个三列网格布局,其中第一行高 150 像素:
.grid-container { display: grid; grid: 150px / auto auto auto; }
例子 2
规定两行,其中 "item1" 跨越前两行中的前两列(采用五列网格布局):
.item1 { grid-area: myArea; } .grid-container { display: grid; grid: 'myArea myArea ...' 'myArea myArea ...'; }
例子 3
命名所有项目,并制作一张现成的网页模板:
.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 syntax
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;
Attribute value
Value | Description |
---|---|
none | Default value. Do not define the size of the rows or columns. |
grid-template-rows / grid-template-columns | Specify the size of the columns and rows. |
grid-template-areas | Specify the use of named item grid layout. |
grid-template-rows / grid-auto-columns | Specify the size (height) of the rows, and the automatic size of the columns. |
grid-auto-rows / grid-template-columns | Specify the automatic size of the rows, and set the grid-template-columns property. |
grid-template-rows / grid-auto-flow grid-auto-columns | Specify the size (height) of the rows, and how to place the auto-positioned items, and the automatic size of the columns. |
grid-auto-flow grid-auto-rows / grid-template-columns | Specify how to place the auto-positioned items, and the automatic size of the rows, and set the grid-template-columns property. |
initial | Set this property to its default value. See initial. |
inherit | Inherit this property from its parent element. See inherit. |
Technical details
Default value: | none none none auto auto row |
---|---|
တိုက်ရိုက်မှု: | no |
Animation creation: | yes, see individual properties. Please see:လှည့်ပတ် လက်တွေး. |
ပုံစံ: | CSS Grid Layout Module Level 1 |
JavaScript လက်တွေး | object.style.grid="250px / auto auto auto" |
ဘရာဇက်ဂျက် အကူအညီ
အခြေအနေ တွင် စာရင်း အမှတ်အသား က အပြော်ကုန်း လက်တွေး ပေါ်တွင် လက်တွေး ကို ပြောဆိုသည်。
Chrome | IE / Edge | Firefox | Safari | Opera |
---|---|---|---|---|
57 | 16 | 52 | 10 | 44 |
အခြား ကြည့်ရန်
CSS ချစ်ဆုံးဆိုင်ရာgrid-template-areas လက်တွေး
CSS ချစ်ဆုံးဆိုင်ရာgrid-template-rows လက်တွေး
CSS ချစ်ဆုံးဆိုင်ရာgrid-template-columns လက်တွေး
CSS ချစ်ဆုံးဆိုင်ရာgrid-auto-rows လက်တွေး
CSS ချစ်ဆုံးဆိုင်ရာgrid-auto-columns လက်တွေး
CSS ချစ်ဆုံးဆိုင်ရာgrid-auto-flow လက်တွေး
CSS ချစ်ဆုံးဆိုင်ရာgrid-row-gap လက်တွေး
CSS ချစ်ဆုံးဆိုင်ရာgrid-column-gap လက်တွေး