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

2.1 KiB

id title challengeType dashedName
5f35e5c44359872a137bd98f Step 28 0 step-28

--description--

Dal momento che il prodotto principale del bar è il caffè, puoi utilizzare un'immagine con dei chicchi di caffè per lo sfondo della pagina.

Elimina il commento e il suo contenuto all'interno del selettore di tipo body. Ora aggiungi una proprietà background-image e assegnale il valore url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg).

--hints--

Dovresti rimuovere la proprietà background-color che avevi trasformato in un commento.

assert(!code.match(/\/\*\s*background-color:\s*burlywood;?\s*\*\//i))

Il selettore body non dovrebbe avere commenti.

assert(!code.match(/body\s*{\s*\/\*/i));

Dovresti assegnare alla proprietà background-image il valore url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg).

const hasBackground = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['background-image'] === `url("https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg")`)
assert(hasBackground)

L'elemento body dovrebbe avere un'immagine di sfondo con dei chicchi di caffè.

const bodyBackground = new __helpers.CSSHelp(document).getStyle('body')?.getPropertyValue('background-image');
console.log(bodyBackground);
assert(bodyBackground === `url("https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg")`);

--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>
  <body>
    <div class="menu">
      <main>
        <h1>CAMPER CAFE</h1>
        <p>Est. 2020</p>
        <section>
          <h2>Coffee</h2>
        </section>
      </main>
    </div>
  </body>
</html>
--fcc-editable-region--
body {
  /*
  background-color: burlywood;
  */
}
--fcc-editable-region--

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

.menu {
  width: 80%;
  background-color: burlywood;
  margin-left: auto;
  margin-right: auto;
}