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

1.7 KiB

id title challengeType dashedName
5f3477cb2e27333b1ab2b955 Step 16 0 step-16

--description--

Ora è necessario collegare il file styles.css in modo che gli stili vengano applicati di nuovo. Annida un elemento link autoconcludente nell'elemento head. Dagli un attributo rel con valore di stylesheet e un attributo href con valore di styles.css.

--hints--

Il codice dovrebbe avere un elemento link.

const link = document.querySelector('link');
assert(link);

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

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

Dovresti avere un elemento link auto-concludente.

const link = document.querySelectorAll('link');
assert(link.length === 1);

L'elemento link dovrebbe essere all'interno dell'elemento head.

const link = document.querySelector('head > link');
assert(link);

L'elemento link dovrebbe avere un attributo rel con il valore stylesheet.

const link = document.querySelector('link')
const rel = link.getAttribute('rel')
assert(rel == `stylesheet`)

L'elemento link dovrebbe avere un attributo href con il valore styles.css.

const link = document.querySelector('link')
assert(link.dataset.href == 'styles.css')

--seed--

--seed-contents--

<!DOCTYPE html>
<html lang="en">
--fcc-editable-region--
  <head>
    <meta charset="utf-8" />
    <title>Cafe Menu</title>
  </head>
--fcc-editable-region--
  <body>
    <main>
      <h1>CAMPER CAFE</h1>
      <p>Est. 2020</p>
      <section>
        <h2>Coffee</h2>
      </section>
    </main>
  </body>
</html>
h1, h2, p {
  text-align: center;
}