DevPrep
  • Interview Prep
  • Projects
  • Resources
  • Pricing
  • About Us
Submit Question
DevPrep
  • Pricing
  • About Us
Submit Question
← From Beginner to Expert in Fundamentals of Frontend
  • Semantic HTML
  • Accessibility (a11y)
  • Forms & Validation
  • Document Metadata & The <head>
  • The Document Object Model (DOM)
  • Character Encoding & Entities
  • Data Attributes & Custom Data
  • Template, Slot & Web Components
  • Responsive Images: Picture, Source & srcset
  • Loading Strategies & Resource Hints
  • The Native Dialog Element
  • Audio, Video & Media APIs
  • SVG Integration & Canvas Basics
  • Advanced Input Types & Datalist
  • Details, Summary, Progress & Meter
  • Global Attributes & Iframe Security
  • Microdata, Schema.org & Structured Data
  • Open Graph & Social Meta Tags
  • Security Headers & CSP in HTML
  • Link Relations & Canonical Tags
← From Beginner to Expert in Fundamentals of Frontend

Document Metadata & The <head>

15 min read
meta charsetviewporthead tagtitle tagmeta descriptionfavicon

Mastering the <head> Element

The <head> is invisible to users but critical for browsers, search engines, and social media. Every line matters.

Essential Meta Tags

TagPurposeImpact
<meta charset="UTF-8">Character encodingWithout it, special characters break
<meta name="viewport">Mobile responsivenessWithout it, mobile shows desktop layout
<title>Browser tab + SEO title#1 on-page SEO factor
<meta name="description">Search result snippetAffects click-through rate
<link rel="icon">FaviconBrand recognition in tabs

The Viewport Meta Tag Explained

<meta name="viewport" content="width=device-width, initial-scale=1">

  • width=device-width: Sets viewport width to the device width (not 980px default)
  • initial-scale=1: Sets initial zoom level to 100%
  • Never use maximum-scale=1: It disables pinch-to-zoom, which is an accessibility violation

Document Type Declaration

<!DOCTYPE html> tells the browser to use standards mode, not quirks mode. Without it, box model calculations and CSS rendering behave unpredictably across browsers.

Meta Robots

Control how search engines treat your page:

  • index, follow — Default. Crawl and index everything.
  • noindex — Do not show in search results.
  • nofollow — Do not follow links on this page.
  • noarchive — Do not show a cached version.

Practice

  • JavaScript
  • DSA
  • Machine Coding
  • System Design

Resources

  • Learning Tracks
  • Articles
  • Roadmaps
  • Compare Concepts
  • Glossary
  • Developer Tools
  • All Questions

Company

  • About
  • Pricing

Legal

  • Privacy Policy
  • Terms of Service
DevPrep

© 2026 DevPrep. All rights reserved.