142 lines
2.7 KiB
Markdown
142 lines
2.7 KiB
Markdown
---
|
|
id: 5d822fd413a79914d39e98dd
|
|
title: Passo 21
|
|
challengeType: 0
|
|
dashedName: step-21
|
|
---
|
|
|
|
# --description--
|
|
|
|
Eu não gosto de como os prédios estão espaçados. Aproxime-os mais adicionando dois elementos `div` vazios no topo do elemento `background-buildings`, mais dois na parte inferior dele e mais um entre `.bb3` e `.bb4`. Esses elementos serão adicionados como elementos uniformemente espaçados pelo contêiner, efetivamente movendo os edifícios mais para perto do centro.
|
|
|
|
# --hints--
|
|
|
|
Você deve adicionar dois novos elementos `div` antes do elemento `.bb1`.
|
|
|
|
```js
|
|
const bBuildings = document.querySelector('.background-buildings')?.children;
|
|
assert(![...bBuildings?.[0]?.classList]?.includes('bb1'));
|
|
assert(![...bBuildings?.[1]?.classList]?.includes('bb1'));
|
|
```
|
|
|
|
Você deve adicionar um novo elemento `div` entre o elemento `.bb3` e `.bb4`.
|
|
|
|
```js
|
|
assert(document.querySelector('.bb3')?.nextElementSibling === document.querySelector('.bb4')?.previousElementSibling);
|
|
```
|
|
|
|
Você deve adicionar dois novos elementos `div` após o elemento `.bb4`.
|
|
|
|
```js
|
|
const bb4 = document.querySelector('.bb4');
|
|
assert.exists(bb4?.nextElementSibling);
|
|
assert.exists(bb4?.nextElementSibling?.nextElementSibling);
|
|
```
|
|
|
|
Você deve adicionar 5 novos elementos `div`.
|
|
|
|
```js
|
|
assert.equal(document.querySelectorAll('div')?.length, 14);
|
|
```
|
|
|
|
# --seed--
|
|
|
|
## --seed-contents--
|
|
|
|
```html
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>City Skyline</title>
|
|
<link href="styles.css" rel="stylesheet" />
|
|
</head>
|
|
|
|
<body>
|
|
--fcc-editable-region--
|
|
<div class="background-buildings">
|
|
<div class="bb1">
|
|
<div class="bb1a"></div>
|
|
<div class="bb1b"></div>
|
|
<div class="bb1c"></div>
|
|
<div class="bb1d"></div>
|
|
</div>
|
|
<div class="bb2"></div>
|
|
<div class="bb3"></div>
|
|
<div class="bb4"></div>
|
|
</div>
|
|
--fcc-editable-region--
|
|
</body>
|
|
</html>
|
|
```
|
|
|
|
```css
|
|
* {
|
|
border: 1px solid black;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
height: 100vh;
|
|
margin: 0;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.background-buildings {
|
|
width: 100%;
|
|
height: 100%;
|
|
display: flex;
|
|
align-items: flex-end;
|
|
justify-content: space-evenly;
|
|
}
|
|
|
|
.bb1 {
|
|
width: 10%;
|
|
height: 70%;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
--building-color1: #aa80ff;
|
|
}
|
|
|
|
.bb1a {
|
|
width: 70%;
|
|
height: 10%;
|
|
background-color: var(--building-color1);
|
|
}
|
|
|
|
.bb1b {
|
|
width: 80%;
|
|
height: 10%;
|
|
background-color: var(--building-color1);
|
|
}
|
|
|
|
.bb1c {
|
|
width: 90%;
|
|
height: 10%;
|
|
background-color: var(--building-color1);
|
|
}
|
|
|
|
.bb1d {
|
|
width: 100%;
|
|
height: 70%;
|
|
background-color: var(--building-color1);
|
|
}
|
|
|
|
.bb2 {
|
|
width: 10%;
|
|
height: 50%;
|
|
}
|
|
|
|
.bb3 {
|
|
width: 10%;
|
|
height: 55%;
|
|
}
|
|
|
|
.bb4 {
|
|
width: 11%;
|
|
height: 58%;
|
|
}
|
|
|
|
```
|
|
|