🇬🇧 Limited Time — UK Only·🎓 Free Learning for 1 Month·🤖 Free AI Training Included·📚 4,000+ Lessons · 35,000+ Quizzes·🏆 GCSE Mocks · Olympiad Papers·⚡ Selected Students Only · Limited Places·🎁 Free Value Worth £2,000·🇬🇧 Limited Time — UK Only·🎓 Free Learning for 1 Month·🤖 Free AI Training Included·📚 4,000+ Lessons · 35,000+ Quizzes·🏆 GCSE Mocks · Olympiad Papers·⚡ Selected Students Only · Limited Places·🎁 Free Value Worth £2,000·🇬🇧 Limited Time — UK Only·🎓 Free Learning for 1 Month·🤖 Free AI Training Included·📚 4,000+ Lessons · 35,000+ Quizzes·🏆 GCSE Mocks · Olympiad Papers·⚡ Selected Students Only · Limited Places·🎁 Free Value Worth £2,000·
🌐 Web (HTML & CSS)

Head and meta tags

The <head> contains metadata: <title> (browser tab), <meta charset="utf-8"> (character encoding), <meta name="viewport" content="width=device-width"> for mobile. Link to CSS with <link rel="stylesheet" href="style.css">.

3 min 10 XP Lesson 8 of 26
Head and meta tags
🌐

Appy Says…

The <head> section of your HTML is invisible to users but incredibly important. Meta tags control how your page appears in Google search results, how it looks when shared on WhatsApp, and whether the mobile experience is good or terrible.

📖

What are Meta Tags?

Meta tags live inside <head> and provide metadata about the page — information for browsers, search engines, and social media platforms.

  • <meta charset="UTF-8"> — character encoding (always include this first)
  • <meta name="viewport" content="width=device-width, initial-scale=1"> — essential for mobile
  • <meta name="description" content="..."> — shown in Google search results
  • <meta property="og:title" content="..."> — Open Graph title for social sharing
  • <meta property="og:image" content="url"> — thumbnail when shared on WhatsApp/Facebook
  • <title>Page Name</title> — shown in browser tab and search results
  • <link rel="icon" href="favicon.ico"> — browser tab icon
🎮

Think of it like your game's app store listing

The title, description, and preview screenshot on the app store aren't inside the game — they're metadata that tells potential users what to expect. Meta tags are your webpage's app store listing for Google and social media.

⚙️

How It Works

  • 1. All meta tags go inside <head></head>
  • 2. The viewport meta tag tells mobile browsers not to zoom out to fit a desktop layout
  • 3. og: (Open Graph) tags control the link preview card on social platforms
  • 4. Twitter uses its own: <meta name="twitter:card" content="summary_large_image">
  • 5. description should be 150–160 chars — Google truncates longer ones
  • 6. robots meta: <meta name="robots" content="noindex"> tells Google not to index a page
🌍

Real-World Examples

  • Missing viewport tag → your site looks zoomed-out on iPhone
  • A good og:image makes WhatsApp/Slack links show a rich preview card
  • Google shows your <title> and description as the search result snippet
  • Vite's index.html template includes charset and viewport meta by default
💡

Key Facts

  • The charset meta MUST be the first tag in <head> — otherwise encoding issues can corrupt the page
  • Open Graph was created by Facebook but is now the standard for social previews across all platforms
  • Google ignores the keywords meta tag — don't waste time on it
  • Tools like Opengraph.xyz let you preview how your meta tags look before publishing
⚠️

Watch Out!

Missing the viewport meta tag is the most common reason a site looks terrible on mobile. <meta name="viewport" content="width=device-width, initial-scale=1"> is non-negotiable for any modern website.

📌

Remember

Every page needs: charset, viewport, title, description. Add og:title, og:description, og:image for good social sharing previews.

What You Learned

  • Meta tags in <head> control charset, mobile layout, SEO, and social previews
  • Viewport meta is essential for mobile; og: tags control social share cards
  • Unlocks: mobile-friendly sites, Google indexing, beautiful WhatsApp link previews

Key Facts

  • The charset meta MUST be the first tag in <head> — otherwise encoding issues can corrupt the page
  • Open Graph was created by Facebook but is now the standard for social previews across all platforms
  • Google ignores the keywords meta tag — don't waste time on it
  • Tools like Opengraph.xyz let you preview how your meta tags look before publishing

Real-World Examples

• Missing viewport tag → your site looks zoomed-out on iPhone • A good <code>og:image</code> makes WhatsApp/Slack links show a rich preview card • Google shows your <code>&lt;title&gt;</code> and <code>description</code> as the search result snippet • Vite's <code>index.html</code> template includes charset and viewport meta by default

Remember

Every page needs: charset, viewport, title, description. Add og:title, og:description, og:image for good social sharing previews.

Quick Quiz

1 / 2

Where does <title> appear?