Files
freeCodeCamp/curriculum/challenges/english/01-responsive-web-design/css-piano/part-002.md
Nicholas Carrigan (he/him) 2cf4a7d787 feat(curriculum): add piano project (#43364)
* feat: i broke it horribly

* fix: background colour first

* chore: apply shaun's review suggestions

Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>

* fix: missing asserts

* chore: apply shaun's review suggestions

Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>

* chore: apply shaun's review suggestions

Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>

* fix: remove extra background

* fix: meta order

* feat: clarify descriptions

Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>
2021-09-13 17:51:42 +01:00

1.4 KiB

id, title, challengeType, dashedName
id title challengeType dashedName
612e77aba7ca691f598feb02 Part 2 0 part-2

--description--

Add two meta tags, one to optimize your page for mobile devices, and one to specify an accepted charset for the page.

--hints--

You should add two meta elements to your page.

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

You should have two meta elements.

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

One meta element should have a name set to viewport, and content set to 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);

The other meta element should have the charset attribute set to UTF-8.

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

--seed--

--seed-contents--

<!DOCTYPE html>
<html>
  <head>
    <title>Responsive Web Design Piano</title>
    --fcc-editable-region--

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