freeCodeCamp/curriculum/challenges/italian/01-responsive-web-design/basic-css/style-the-html-body-element.md

1.2 KiB

id title challengeType videoUrl forumTopicId dashedName
bad87fee1348bd9aedf08736 Stilizzare l'elemento Body 0 https://scrimba.com/c/cB77PHW 18313 style-the-html-body-element

--description--

Ora iniziamo a parlare dell'ereditarietà dei CSS.

Ogni pagina HTML ha un elemento body.

--instructions--

Possiamo dimostrare che l'elemento body esiste dandogli un background-color nero.

Possiamo farlo aggiungendo quanto segue al nostro elemento style:

body {
  background-color: black;
}

--hints--

Il tuo elemento body dovrebbe avere il background-color nero.

assert($('body').css('background-color') === 'rgb(0, 0, 0)');

La regola CSS dovrebbe essere formattata correttamente con entrambe le parentesi graffe di apertura e chiusura.

assert(
  code.match(/<style>\s*body\s*\{\s*background.*\s*:\s*.*;\s*\}\s*<\/style>/i)
);

La tua regola CSS dovrebbe terminare con un punto e virgola.

assert(
  code.match(/<style>\s*body\s*\{\s*background.*\s*:\s*.*;\s*\}\s*<\/style>/i)
);

--seed--

--seed-contents--

<style>

</style>

--solutions--

<style>
body {
  background-color: black;
}
</style>