HTML & CSSEasy
What is the <meta> tag?
<meta> is a void element inside <head> that provides metadata about the document which is not displayed on the page: the character encoding, viewport settings for mobile, the description shown in search results, social sharing information (Open Graph), theme colors, and instructions for crawlers.
Common meta tags
<meta charset="utf-8">: character encoding; should be the first element in<head>.<meta name="viewport" content="width=device-width, initial-scale=1">: responsive layout on mobile.<meta name="description" content="...">: page summary, often used as the search snippet.<meta name="robots" content="noindex, nofollow">: crawler instructions.<meta name="theme-color" content="#4f46e5" media="(prefers-color-scheme: light)">: browser UI color.<meta name="color-scheme" content="light dark">: tells the browser the page supports both, so default form controls and scrollbars match before CSS loads.<meta property="og:title">,og:description,og:image,og:url: link previews on social apps and chat tools.<meta name="twitter:card" content="summary_large_image">.<meta http-equiv="Content-Security-Policy" content="...">: a CSP fallback when you cannot set headers.
Attributes
name+contentfor named metadata.property+contentfor Open Graph (RDFa).http-equiv+contentto emulate HTTP headers.charsetfor encoding.
Things meta does not do anymore
<meta name="keywords"> is ignored by major search engines. <meta http-equiv="refresh"> redirects are bad for accessibility and SEO; use server redirects.
Frameworks
Next.js's Metadata API, React 19's built-in <title> and <meta> hoisting, and similar tools generate these tags for you.
Code example
html
1<!doctype html>2<html lang="en">3<head>4 <meta charset="utf-8">5 <meta name="viewport" content="width=device-width, initial-scale=1">6 <title>CSS Container Queries Guide | DevQnA</title>7 <meta name="description" content="Learn how container queries let components adapt to their parent's size, with live examples.">8 <meta name="color-scheme" content="light dark">9 <meta name="theme-color" content="#ffffff" media="(prefers-color-scheme: light)">10 <meta name="theme-color" content="#0b1020" media="(prefers-color-scheme: dark)">1112 <!-- Social previews -->13 <meta property="og:type" content="article">14 <meta property="og:title" content="CSS Container Queries Guide">15 <meta property="og:description" content="Components that adapt to their container.">16 <meta property="og:image" content="https://example.com/og/container-queries.png">17 <meta property="og:url" content="https://example.com/guides/container-queries">18 <meta name="twitter:card" content="summary_large_image">1920 <!-- Keep staging out of search results -->21 <!-- <meta name="robots" content="noindex"> -->22</head>23<body><h1>CSS Container Queries Guide</h1></body>24</html>
Practice this question
Open it in the study app to track progress, take notes, listen to the answer and work through the rest of the HTML & CSS set.