2.1 KiB
2.1 KiB
id | challengeType | videoUrl | forumTopicId | localeTitle |
---|---|---|---|---|
5a94fe1369fb03452672e45d | 0 | https://scrimba.com/p/pByETK/cRrqmtV | 301132 | 使用 grid-area 属性将项目放置在网格区域中 |
Description
grid-area
:
.item1 {
grid-area: header;
}
这样,类名为item1
的网格项就被放到了header
区域里。在这个示例中,网格项将占用整个顶行,因为这一整行都被命名为 header 区域。
Instructions
grid-area
属性,把类为item5
元素放到footer
区域。
Tests
tests:
- text: '<code>item5</code>类应该有<code>grid-area</code>属性且值为<code>footer</code>。'
testString: assert(code.match(/.item5\s*?{[\s\S]*grid-area\s*?:\s*?footer\s*?;[\s\S]*}/gi));
Challenge Seed
<style>
.item1{background:LightSkyBlue;}
.item2{background:LightSalmon;}
.item3{background:PaleTurquoise;}
.item4{background:LightPink;}
.item5 {
background: PaleGreen;
/* 请在本行以下添加你的代码 */
/* 请在本行以上添加你的代码 */
}
.container {
font-size: 40px;
min-height: 300px;
width: 100%;
background: LightGray;
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-template-rows: 1fr 1fr 1fr;
grid-gap: 10px;
grid-template-areas:
"header header header"
"advert content content"
"footer footer footer";
}
</style>
<div class="container">
<div class="item1">1</div>
<div class="item2">2</div>
<div class="item3">3</div>
<div class="item4">4</div>
<div class="item5">5</div>
</div>
Solution
// solution required