freeCodeCamp/curriculum/challenges/espanol/14-responsive-web-design-22/learn-responsive-web-design.../612e77aba7ca691f598feb02.md

1.4 KiB

id title challengeType dashedName
612e77aba7ca691f598feb02 Paso 2 0 step-2

--description--

Agrega dos etiquetas meta, una para optimizar tu página para dispositivos móviles y una para especificar el charset aceptado de la página.

--hints--

Debes agregar dos elementos meta a tu página.

const meta = document.querySelector('meta');
assert.exists(meta);

Debes tener dos elementos meta.

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

Un elemento meta debe tener el name establecido en viewport y el content establecido en width=device-width, initial-scale=1.0.

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

El otro elemento meta debe tener el atributo charset establecido en 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--

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Piano</title>
    --fcc-editable-region--

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