<title> Tag — HTML Technical Interview Questions & Answers

The document title shown in the browser tab.

<title> Tag

  • The document title shown in the browser tab.
  • <title> is the <title> HTML element. HTML uses this tag so the browser (and screen readers) know what the piece is, not only how it looks.
  • Board: <title>…</title> Put it in body. Check it in the browser. Attributes go on the opening tag.
  • Trap: wrong nesting or missing a required attribute. CSS can still style it — don’t pick a tag only because of default italics.
  • Interview: name the tag, one attribute if it has a famous one (href, src, alt, for, type), one mistake.

Technical Interview Tip: <title>: the <title> HTML element. Example: <title>…</title>

Code Examples for <title> Tag

<title> Tag — working example

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title><title> Tag</title>
  </head>
  <body>
    <main>
      <h1><title> Tag</h1>
      <p>Semantic HTML example for this topic.</p>
      <ul>
        <li>Use the right element</li>
        <li>Add accessible text</li>
      </ul>
    </main>
  </body>
</html>

<title> Tag: doctype + one h1 + a short list. That is the page skeleton.

How to Explain <title> Tag to an Interviewer

What is the <title> tag?

the <title> HTML element <title>…</title>

One common mistake?

wrong nesting or missing a required attribute