CSS grid-template ɗanin
- 上一页 grid-row-start
- 下一页 grid-template-areas
التعريف والاستخدام
خصائص grid-template هي اختصار لخصائص التالية:
الرجاء الرجوع إلى:
دليل CSS:Hausa translation of CSS Grid items
كتيب CSS المرجعي:خصائص grid-area
كتيب CSS المرجعي:خصائص grid-template-rows
كتيب CSS المرجعي:خصائص grid-template-columns
كتيب CSS المرجعي:خصائص grid-template-areas
مثال
مثال 1
ايا ما كان اول عمود 150 بكسل من تصميم الشبكة الثلاثية:
.grid-container { display: grid; grid-template: 150px / auto auto auto; }
例子 2
规定两行,其中 "item1" 横跨前两行中的前两列(在一个五列网格布局中):
.item1 { grid-area: myArea; } .grid-container { display: grid; grid-template: '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-template: 'header header header header header header' 'menu main main main right right' 'menu footer footer footer footer'; }
CSS 语法
grid-template: none|grid-template-rows / grid-template-columns|grid-template-areas|initial|inherit;
值 | 描述 |
---|---|
none | 默认值。不规定列或行的尺寸。 |
grid-template-rows / grid-template-columns | 规定列和行的尺寸。 |
grid-template-areas | 规定使用命名项目的网格布局。 |
initial | 将此属性设置为其默认值。参阅 initial。 |
inherit | 从其父元素继承此属性。参阅 inherit。 |
技术细节
默认值: | none none none |
---|---|
继承: | 否 |
动画制作: | 支持。请参阅:动画相关属性。 |
版本: | CSS Grid Layout Module Level 1 |
JavaScript 语法: | object.style.gridTemplate="250px / auto auto" |
浏览器支持
表格中的数字注明了完全支持该属性的首个浏览器版本。
Hausa translation of Chrome | Hausa translation of IE / Edge | Hausa translation of Firefox | Hausa translation of Safari | Hausa translation of Opera |
---|---|---|---|---|
57 | 16 | 52 | 10 | 44 |
- 上一页 grid-row-start
- 下一页 grid-template-areas