freeCodeCamp/curriculum/challenges/italian/14-responsive-web-design-22/learn-css-flexbox-by-buildi.../61537a8054753e2f1f2a1574.md

1.4 KiB

id title challengeType dashedName
61537a8054753e2f1f2a1574 Step 2 0 step-2

--description--

All'interno dell'elemento head, aggiungi un tag meta con l'attributo name impostato su viewport e l'attributo content con il valore width=device-width, initial-scale=1.

Aggiungi anche un tag meta con l'attributo charset impostato su UTF-8.

--hints--

Dovresti avere due elementi meta.

const meta = document.querySelectorAll('meta');
assert(meta?.length === 2);

Un elemento meta dovrebbe avere un attributo name con il valore viewport e un attributo content con il valore width=device-width, initial-scale=1.0.

const meta = [...document.querySelectorAll('meta')];
const target = meta?.find(m => m?.getAttribute('name') === 'viewport' && m?.getAttribute('content').match(/width=device-width,\s?initial-scale=1(.0)?/) && !m?.getAttribute('charset'));
assert.exists(target);

L'altro elemento meta dovrebbe avere l'attributo charset con il valore UTF-8.

const meta = [...document.querySelectorAll('meta')];
const target = meta?.find(m => !m?.getAttribute('name') && !m?.getAttribute('content') && m?.getAttribute('charset')?.toLowerCase() === 'utf-8');
assert.exists(target);

--seed--

--seed-contents--

--fcc-editable-region--
<!DOCTYPE html>
<html>
  <head>

  </head>
  <body>
  </body>
</html>
--fcc-editable-region--