freeCodeCamp/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-css-variables-by-buil.../5d822fd413a79914d39e98dd.md

2.7 KiB

id title challengeType dashedName
5d822fd413a79914d39e98dd Passo 21 0 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.

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.

assert(document.querySelector('.bb3')?.nextElementSibling === document.querySelector('.bb4')?.previousElementSibling);

Você deve adicionar dois novos elementos div após o elemento .bb4.

const bb4 = document.querySelector('.bb4');
assert.exists(bb4?.nextElementSibling);
assert.exists(bb4?.nextElementSibling?.nextElementSibling);

Você deve adicionar 5 novos elementos div.

assert.equal(document.querySelectorAll('div')?.length, 14);

--seed--

--seed-contents--

<!DOCTYPE html>
<html lang="en">    
  <head>
    <meta charset="UTF-8">
    <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>
* {
  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%;
}