freeCodeCamp/curriculum/challenges/italian/14-responsive-web-design-22/learn-the-css-box-model-by-.../60a3e3396c7b40068ad69978.md

1.4 KiB

id title challengeType dashedName
60a3e3396c7b40068ad69978 Step 15 0 step-15

--description--

Utilizza i margini per regolare la spaziatura all'esterno di un elemento.

Utilizzando la proprietà margin, assegna all'elemento .frame un margine verticale di 20px e un margine orizzontale impostato su auto. Questo sposterà l'elemento frame verso il basso di 20 pixel e lo centrerà orizzontalmente sulla pagina.

--hints--

Dovresti assegnare alla proprietà margin il valore 20px auto.

const hasMargin = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style.margin === '20px auto');
assert(hasMargin);

Il selettore .frame dovrebbe avere una proprietà margin con il valore 20px auto.

const frameMargin = new __helpers.CSSHelp(document).getStyle('.frame')?.getPropertyValue('margin');
assert(frameMargin === '20px auto');

--seed--

--seed-contents--

.canvas {
  width: 500px;
  height: 600px;
  background-color: #4d0f00;
}

.frame {
  border: 50px solid black;
  width: 500px;
  padding: 50px;
--fcc-editable-region--

--fcc-editable-region--
}
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>Rothko Painting</title>
    <link href="./styles.css" rel="stylesheet">
  </head>
  <body>
    <div class="frame">
      <div class="canvas">
      </div>
    </div>
  </body>
</html>