Skip to content
Learn Netverks

Lesson

Step 17/58 29% through track

head

Document head

Last reviewed May 28, 2026 Content v20260528
Track mode
iframe_html
Means
HTML preview sandbox
Reading
~2 min
Level
advanced

This lesson

This lesson teaches Document head—the ideas, syntax, and habits you need before moving on in HTML.

Without a solid grasp of Document head, you will repeat mistakes in HTML exercises and on real pages or scripts.

You will apply Document head in contexts like: Websites, hybrid apps, email templates, design systems, and CMS-driven content.

Read the lesson, edit HTML/CSS in the playground, press Run to preview, then answer the lesson MCQs. Also use the HTML reference desk when you need tag or attribute lookup.

When intermediate lessons feel comfortable and you are ready for production-style trade-offs.

The <head> aggregates metadata: character encoding, viewport behavior, title, social sharing tags, discovery feeds, stylesheets, preloads, and scripts when necessary.

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Pricing — Example Co</title>
  <meta name="description" content="Compare plans side-by-side.">
  <meta property="og:title" content="Pricing">
  <link rel="canonical" href="https://example.com/pricing">
  <link rel="stylesheet" href="/app.css">
</head>

Critical tags explained

  • charset: early declaration avoids incorrect decoding.
  • viewport: maps CSS pixels to device width on mobile.
  • title: influences tabs, bookmarks, and often SERP titles.
  • meta description: may appear as snippets—write human sentences.
  • Open Graph / Twitter: customize previews when sharing URLs.

Rules

  • Do not place visible body content inside head; parsers relocate stray tags unpredictably.
  • Prefer declarative links (link) over imports injected via scripts when possible.

What production teams miss

  • SEO/social duplication: inconsistent title vs OG tags confuses previews—treat metadata as contractual copy with marketing/legal.
  • Prefetch abuse: preloading every route starves bandwidth—coordinate with perf budgets.
  • Fingerprinting leakage: third-party widgets inject their own meta/link tags via JS—inventory them in security reviews.

Performance ordering

charset, viewport, and critical preconnect hints should arrive early—large inline JSON blobs in head push discovery later and harm FCP psychologically even if parsers cope.

Important interview questions and answers

  1. Q: What makes image delivery accessible and performant?
    A: Meaningful `alt`, correct intrinsic `width`/`height`, and responsive sources (`srcset`/`sizes` or `picture`) based on viewport needs.
  2. Q: When do you use a table in HTML?
    A: Only for real tabular data, not page layout; use `th`, `scope`, and `caption` to preserve structure for assistive tech.
  3. Q: What is the role of the `head` element in production apps?
    A: It provides critical metadata like charset, viewport, title, canonical/social tags, and linked resources used by browsers and crawlers.

Pitfall: Missing viewport meta makes mobile layouts look zoomed out.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs in your browser in a sandboxed frame. Backend runners appear when this track’s profile allows them.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • What confused you about this lesson?
  • How would you explain this to a teammate in 30 seconds?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump