Back to Freecodecamp

Step 13

curriculum/challenges/english/blocks/workshop-cafe-menu/5f3477cbcb6ba47918c1da92.md

latest1.5 KB
Original Source

--description--

For the styling of the page to look similar on mobile as it does on a desktop or laptop, you need to add a meta element with a special content attribute.

You learned about the viewport meta element in previous lessons.

Here is an example:

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

--hints--

Your code should have two meta elements.

js
assert.lengthOf(code.match(/<meta.*?\/?>/g),2);

Your meta element should have a name attribute with a value of viewport.

js
const meta = document.querySelectorAll('meta');
assert.exists(meta[0]?.outerHTML?.match(/name=('|")viewport\1/) || meta[1]?.outerHTML?.match(/name=('|")viewport\1/));

Your meta element should have a content attribute with a value of width=device-width, initial-scale=1.0.

js
const meta = document.querySelectorAll('meta');
assert.exists(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--

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