freeCodeCamp/curriculum/challenges/italian/14-responsive-web-design-22/learn-css-animation-by-buil.../6140d4bc9db3c81c51a09ab7.md

5.1 KiB

id title challengeType dashedName
6140d4bc9db3c81c51a09ab7 Step 15 0 step-15

--description--

Continuando lo schema, seleziona i seguenti elementi .cabin e applica loro le regole specificate:

  • Il secondo .cabin dovrebbe avere la proprietà right impostata al 17% e la proprietà top impostata al 93.5%.
  • Il terzo .cabin dovrebbe avere la proprietà right impostata al 67% e la proprietà top impostata al 93.5%.
  • Il quarto .cabin dovrebbe avere la proprietà left impostata a -8.5% e la proprietà top impostata al 50%.
  • Il quinto .cabin dovrebbe avere la proprietà left impostata al 17% e la proprietà top impostata al 7%.
  • Il sesto .cabin dovrebbe avere la proprietà right impostata al 17% e la proprietà top impostata al 7%.

--hints--

Dovresti avere un selettore .cabin:nth-of-type(2).

assert(new __helpers.CSSHelp(document).getStyle('.cabin:nth-of-type(2)'));

Il selettore .cabin:nth-of-type(2) dovrebbe avere una proprietà right impostata sul 17%.

assert(new __helpers.CSSHelp(document).getStyle('.cabin:nth-of-type(2)')?.right === '17%');

Il selettore .cabin:nth-of-type(2) dovrebbe avere una proprietà top impostata al 93.5%.

assert(new __helpers.CSSHelp(document).getStyle('.cabin:nth-of-type(2)')?.top === '93.5%');

Dovresti avere un selettore .cabin:nth-of-type(3).

assert(new __helpers.CSSHelp(document).getStyle('.cabin:nth-of-type(3)'));

Il selettore .cabin:nth-of-type(3) dovrebbe avere una proprietà right impostata sul 67%.

assert(new __helpers.CSSHelp(document).getStyle('.cabin:nth-of-type(3)')?.right === '67%');

Il selettore .cabin:nth-of-type(3) dovrebbe avere una proprietà top impostata al 93.5%.

assert(new __helpers.CSSHelp(document).getStyle('.cabin:nth-of-type(3)')?.top === '93.5%');

Dovresti avere un selettore .cabin:nth-of-type(4).

assert(new __helpers.CSSHelp(document).getStyle('.cabin:nth-of-type(4)'));

Il selettore .cabin:nth-of-type(4) dovrebbe avere una proprietà left impostata su -8.5%.

assert(new __helpers.CSSHelp(document).getStyle('.cabin:nth-of-type(4)')?.left === '-8.5%');

Il selettore .cabin:nth-of-type(4) dovrebbe avere una proprietà top impostata al 50%.

assert(new __helpers.CSSHelp(document).getStyle('.cabin:nth-of-type(4)')?.top === '50%');

Dovresti avere un selettore .cabin:nth-of-type(5).

assert(new __helpers.CSSHelp(document).getStyle('.cabin:nth-of-type(5)'));

Il selettore .cabin:nth-of-type(5) dovrebbe avere una proprietà left impostata sul 17%.

assert(new __helpers.CSSHelp(document).getStyle('.cabin:nth-of-type(5)')?.left === '17%');

Il selettore .cabin:nth-of-type(5) dovrebbe avere una proprietà top impostata al 7%.

assert(new __helpers.CSSHelp(document).getStyle('.cabin:nth-of-type(5)')?.top === '7%');

Dovresti avere un selettore .cabin:nth-of-type(6).

const def = (s) => new __helpers.CSSHelp(document).getStyle(s)
assert(def('.cabin:nth-of-type(6)') || def('.cabin:last-of-type'));

Il selettore .cabin:nth-of-type(6) dovrebbe avere una proprietà right impostata sul 17%.

const right = (s) => new __helpers.CSSHelp(document).getStyle(s)?.right
assert.equal(right('.cabin:nth-of-type(6)') || right('.cabin:last-of-type'),'17%');

Il selettore .cabin:nth-of-type(6) dovrebbe avere una proprietà top impostata al 7%.

const top = (s) => new __helpers.CSSHelp(document).getStyle(s)?.top
assert.equal(top('.cabin:nth-of-type(6)') || top('.cabin:last-of-type'),'7%');

--seed--

--seed-contents--

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>Ferris Wheel</title>
    <link rel="stylesheet" href="./styles.css">
  </head>
  <body>
    <div class="wheel">
      <span class="line"></span>
      <span class="line"></span>
      <span class="line"></span>
      <span class="line"></span>
      <span class="line"></span>
      <span class="line"></span>

      <div class="cabin"></div>
      <div class="cabin"></div>
      <div class="cabin"></div>
      <div class="cabin"></div>
      <div class="cabin"></div>
      <div class="cabin"></div>
    </div>
  </body>
</html>
.wheel {
  border: 2px solid black;
  border-radius: 50%;
  margin-left: 50px;
  position: absolute;
  height: 55vw;
  width: 55vw;
  max-width: 500px;
  max-height: 500px;
}

.line {
  background-color: black;
  width: 50%;
  height: 2px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: 0% 0%;
}

.line:nth-of-type(2) {
  transform: rotate(60deg);
}
.line:nth-of-type(3) {
  transform: rotate(120deg);
}
.line:nth-of-type(4) {
  transform: rotate(180deg);
}
.line:nth-of-type(5) {
  transform: rotate(240deg);
}
.line:nth-of-type(6) {
  transform: rotate(300deg);
}

.cabin {
  background-color: red;
  width: 20%;
  height: 20%;
  position: absolute;
  border: 2px solid;
  transform-origin: 50% 0%;
}

.cabin:nth-of-type(1) {
  right: -8.5%;
  top: 50%;
}
--fcc-editable-region--

--fcc-editable-region--