Skip to main content
Syllabus

HTML Head Element Deep Dive

Badar KhalilUpdated September 27, 2026 2 min read

HTML Head Element Deep Dive

Focus keyword: HTML head element — the invisible but critical part of every web page that controls SEO, browser behavior, and social sharing appearance.

The <head> element sits at the top of an HTML document and contains metadata — information about the page that isn't displayed directly to users but is essential for browsers, search engines, and social platforms.

1. Essential Head Elements

  • <title> — sets the browser tab title and is a major SEO ranking factor
  • <meta charset="UTF-8"> — defines character encoding, should always be the first line inside head
  • <meta name="viewport" content="width=device-width, initial-scale=1"> — essential for mobile-responsive design
  • <link rel="stylesheet"> — links external CSS files
  • <script> — can load JS (often placed with defer for performance)

2. SEO Meta Tags

Search-engine-focused tags include:

  • <meta name="description" content="..."> — the snippet shown in Google search results
  • <link rel="canonical" href="..."> — prevents duplicate content penalties
  • <meta name="robots" content="index, follow"> — controls search engine crawling behavior

3. Social Sharing: Open Graph & Twitter Cards

Trending in modern SEO/marketing workflows, Open Graph tags control how a link looks when shared on Facebook, LinkedIn, or WhatsApp:

  • og:title, og:description, og:image, og:url
  • twitter:card for Twitter/X-specific preview styling

4. Favicon

The small icon shown in browser tabs is set via <link rel="icon" href="favicon.ico">.

5. Structured Data (Schema.org)

Adding JSON-LD structured data inside the head helps search engines display rich snippets (star ratings, FAQs, breadcrumbs) — a highly trending modern SEO technique.

Try it Yourself HTML
Output

Press Run to execute.

Try it Yourself HTML
Output

Press Run to execute.

Try it Yourself HTML
Output

Press Run to execute.

Exercise: Complete a Missing Head SectionHTML

The head section below is missing charset, viewport, title, and a meta description. Add all four in the correct order (charset first).

Try it Yourself HTML
Output

Press Run to execute.

Show expected output
A head element with meta charset first, followed by viewport meta, a title tag, and a meta description tag.

This is a self-check — compare your result with the expected output above.

Quiz: HTML Head Element Quiz Pass 70%
Loading quiz…

Was this page helpful?