Meta tags (charset and viewport), online

Six activities your students do on their own devices. See who's finished, and their scores.

Meta tags (charset and viewport) in one minute

What students need to know

<meta> tags do not have a separate closing tag. The tag ends after the attribute and the closing angle bracket >. <meta> provides metadata about the page and belongs in <head> alongside <title> and stylesheet links.

<meta> is self-closing. Writing </meta> is invalid - just write the opening tag with its attributes. Character encoding is set with the charset attribute directly: <meta charset="UTF-8">.

Mistakes students make

  • <meta> is a self-closing tag - it must not have a closing slash before the tag name. The correct form is <meta charset="UTF-8">, not </meta charset="UTF-8">.
  • "carset" is a misspelling. The correct attribute name is charset, which tells the browser to use Unicode character encoding.
  • <meta> is a self-closing element - it does not have a separate closing </meta> tag. Remove the </meta> line entirely.
  • <meta> tags must be placed inside <head>, not inside <body>. Move the charset meta tag into the <head> section.
PREVIOUS · MODULE 5The title element
YOU ARE HERE · MODULE 6Meta tags (charset and viewport)
NEXT · MODULE 7HTML comments

Discover other journeys with this module

What students will learn in this module

Every question in Module 6

Quick questions

  1. Where must <meta> tags be placed in an HTML document?AInside <head>BInside <body>
  2. True or false: <meta> is a self-closing tag - it does not need a </meta> closing tag.AFalseBTrue
  3. Which meta tag sets the character encoding to Unicode?A<meta charset="UTF-8">B<meta name="charset" content="UTF-8">
  4. What does the viewport meta tag control?AThe background colour of the pageBHow the page scales on mobile devices
  5. True or false: a page can have both a charset meta tag and a viewport meta tag.ATrueBFalse

Key terms

Students type the meaning of:

  • <meta>

Match the pairs

<meta charset="UTF-8">Match it to what it does
<meta name="viewport" content="width=device-width, initial-scale=1.0">Match it to what it does
<meta> is a self-closing element - no closing </meta> tag is neededMatch it to what it does
<meta> tags must be placed inside <head>, not <body>Match it to what it does
<meta charset="UTF-8"></meta>Match it to what it does
<body>
  <meta charset="UTF-8">
</body>
Match it to what it does

Fill in the blanks

  1. <head>
      <___ charset="UTF-8">
    </head>

    Hint: Type the self-closing element name used for page metadata

  2. <head>
      <meta ___="UTF-8">
    </head>

    Hint: Type the attribute name that sets the character encoding

  3. <head>
      <meta charset="___">
    </head>

    Hint: Type the Unicode character encoding value

  4. <head>
      <meta name="___" content="width=device-width, initial-scale=1.0">
    </head>

    Hint: Type the meta name value that controls mobile scaling

  5. <head>
      <meta ___="viewport" content="width=device-width">
    </head>

    Hint: Type the attribute used to identify the type of meta information

Spot the error

Question 1

A</meta charset="UTF-8">B  <title>My Page</title>C</head>

Question 2

A<head>B  <meta carset="UTF-8">C  <title>My Site</title>D</head>

Question 3

A<head>B  <meta charset="UTF-8">C  <meta name="viewport" content="width=device-width">D  </meta>

Question 4

A<!DOCTYPE html>B<html>C  <head>D  <body>E    <meta charset="UTF-8">F  </body>

Question 5

A<head>B  <meta charset="UTF-8">C  <meta name="viewprt" content="width=device-width">D  <title>Page</title>E</head>