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

1.5 KiB

id title challengeType dashedName
5f3477cbcb6ba47918c1da92 Step 18 0 step-18

--description--

Per far sì che lo stile della pagina sia simile su uno smatphone, su un desktop o un laptop, devi aggiungere un elemento meta con un attributo speciale content.

Aggiungi il seguente codice all'interno dell'elemento head:

<meta name="viewport" content="width=device-width, initial-scale=1.0" />

--hints--

Il codice dovrebbe avere due elementi meta.

assert(code.match(/<meta.*\/?>/g).length === 2);

L'elemento meta dovrebbe avere un attributo name con il valore viewport.

const meta = $('meta');
assert(meta[0].outerHTML.match(/name=('|")viewport\1/) || meta[1].outerHTML.match(/name=('|")viewport\1/));

L'elemento meta dovrebbe avere un attributo content con il valore width=device-width, initial-scale=1.0.

const meta = $('meta');
assert(meta[0].outerHTML.match(/content=('|")width=device-width, initial-scale=1.0\1/) || meta[1].outerHTML.match(/content=('|")width=device-width, initial-scale=1.0\1/));

--seed--

--seed-contents--

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