2018-10-10 18:03:03 -04:00
---
id: 5a94fe8569fb03452672e464
title: Create Grids within Grids
challengeType: 0
2019-08-28 16:26:13 +03:00
videoUrl: https://scrimba.com/p/pByETK/c6N78Ap
forumTopicId: 301128
2018-10-10 18:03:03 -04:00
localeTitle: Создание гридов в сетках
---
## Description
2019-08-28 16:26:13 +03:00
< section id = 'description' >
Включение элемента в сетку влияет только на поведение е г о прямых потомков. Поэтому, превратив прямого потомка в сетку, у вас есть сетка внутри сетки. Например, задав свойства < code > display< / code > и < code > grid-template-columns< / code > элемента с классом < code > item3< / code > , вы создаете сетку в своей сетке.
< / section >
2018-10-10 18:03:03 -04:00
## Instructions
2019-08-28 16:26:13 +03:00
< section id = 'instructions' >
Поверните элемент с классом < code > item3< / code > в сетку с двумя столбцами с шириной < code > auto< / code > и < code > 1fr< / code > используя < code > 1fr< / code > < code > display< / code > и < code > grid-template-columns< / code > .
< / section >
2018-10-10 18:03:03 -04:00
## Tests
< section id = 'tests' >
```yml
tests:
2019-08-28 16:26:13 +03:00
- text: < code > item3</ code > class should have a < code > grid-template-columns</ code > property with < code > auto</ code > and < code > 1fr</ code > as values.
testString: assert(code.match(/.item3\s*?{[\s\S]*grid-template-columns\s*?:\s*?auto\s*?1fr\s*?;[\s\S]*}/gi));
- text: < code > item3</ code > class should have a < code > display</ code > property with the value of < code > grid</ code > .
testString: assert(code.match(/.item3\s*?{[\s\S]*display\s*?:\s*?grid\s*?;[\s\S]*}/gi));
2018-10-10 18:03:03 -04:00
```
< / section >
## Challenge Seed
< section id = 'challengeSeed' >
< div id = 'html-seed' >
```html
< style >
.container {
font-size: 1.5em;
min-height: 300px;
width: 100%;
background: LightGray;
display: grid;
grid-template-columns: auto 1fr;
grid-template-rows: auto 1fr auto;
grid-gap: 10px;
grid-template-areas:
"advert header"
"advert content"
"advert footer";
}
.item1 {
background: LightSkyBlue;
grid-area: header;
}
.item2 {
background: LightSalmon;
grid-area: advert;
}
.item3 {
background: PaleTurquoise;
grid-area: content;
/* enter your code below this line */
/* enter your code above this line */
}
.item4 {
background: lightpink;
grid-area: footer;
}
.itemOne {
background: PaleGreen;
}
.itemTwo {
background: BlanchedAlmond;
}
< / style >
< div class = "container" >
< div class = "item1" > header< / div >
< div class = "item2" > advert< / div >
< div class = "item3" >
< div class = "itemOne" > paragraph1< / div >
< div class = "itemTwo" > paragraph2< / div >
< / div >
< div class = "item4" > footer< / div >
< / div >
```
< / div >
< / section >
## Solution
< section id = 'solution' >
2019-08-28 16:26:13 +03:00
```html
var code = ".item3 {grid-template-columns: auto 1fr; display: grid;}"
2018-10-10 18:03:03 -04:00
```
2019-08-28 16:26:13 +03:00
2018-10-10 18:03:03 -04:00
< / section >