freeCodeCamp/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building.../5f356ed6cf6eab5f15f5cfe6.md

1.4 KiB

id title challengeType dashedName
5f356ed6cf6eab5f15f5cfe6 Step 20 0 step-20

--description--

A differenza degli altri elementi di contenuto che hai utilizzato finora, l'elemento div è utilizzato principalmente per il design del layout. Aggiungi un elemento div all'interno dell'elemento body e poi sposta tutti gli altri elementi all'interno del nuovo elemento div.

--hints--

Dovresti avere un tag di apertura <div>.

assert(code.match(/<div>/i));

Dovresti avere un tag di chiusura </div>.

assert(code.match(/<\/div>/i));

Non dovresti cambiare l'elemento body esistente. Assicurati di non aver eliminato il tag di chiusura.

assert($('body').length === 1);

Il tag div dovrebbe essere annidato nell'elemento body.

const div = $('div')[0];
assert(div.parentElement.tagName === 'BODY');

--seed--

--seed-contents--

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Cafe Menu</title>
    <link href="styles.css" rel="stylesheet"/>
  </head>
--fcc-editable-region--
  <body>
    <main>
      <h1>CAMPER CAFE</h1>
      <p>Est. 2020</p>
      <section>
        <h2>Coffee</h2>
      </section>
    </main>
  </body>
--fcc-editable-region--
</html>
body {
  background-color: burlywood;
}

h1, h2, p {
  text-align: center;
}