charset
Defines the character encoding.
Learn HTML Meta with practical examples for structure, layout semantics, metadata, embedded content, scripts, accessibility, SEO and live practice.
HTML structure and layout
The meta element is used inside head for metadata that does not have its own dedicated HTML element. Common examples include charset, viewport, description, robots and social sharing tags.
Meta tags are powerful because they affect behavior outside the visible page: mobile scaling, snippets, indexing and link previews.
Good meta is specific, honest and page-level. Repeating the same generic metadata on every page wastes a useful signal.
Defines the character encoding.
Controls mobile viewport scaling.
Short human-readable page summary.
Search indexing and crawling instructions.
Syntax and structure
Most meta tags use name and content. Charset is a special case with its own attribute.
<meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content="Learn HTML meta tags with practical examples."> <meta name="robots" content="index,follow">
<meta name="description" content="Best website, cheap, fast, amazing, number one."> <meta name="keywords" content="html,html,html,html tutorial">
HTML quick reference
Use these patterns when you need the syntax quickly. Each example has its own anchor, so search engines and readers can land directly on the exact pattern instead of only at the top of the lesson.
A clean version of the markup from this lesson. Use it when you need the correct HTML shape quickly.
<meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content="Learn HTML meta tags with practical examples."> <meta name="robots" content="index,follow">
Meaningful markup that stays understandable before CSS and JavaScript are added.
The starting point from the practice lab. Change the HTML first, then use CSS only for presentation.
<main class="demo-card"> <h1>Meta checklist</h1> <p>Write metadata for a page about semantic HTML.</p> <pre><meta name="description" content="..."></pre> </main> <style> body { margin: 0; min-height: 100vh; display: grid; place-items: center; font-family: Inter, system-ui, sans-serif; background: #07111f; color: white; } .demo-card { width: min(820px, calc(100% - 32px)); padding: 34px; border-radius: 24px; background: #101a2d; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3); } h1 { margin: 0 0 16px; font-size: clamp(34px, 7vw, 58px); line-height: 1; } h2 { margin: 0 0 10px; } p, li { color: #cfd8e6; line-height: 1.7; } a { color: #8cffc1; font-weight: 900; } button { border: 0; border-radius: 999px; padding: 12px 16px; background: #8cffc1; color: #07111f; font-weight: 900; } pre { white-space: pre-wrap; color: #8cffc1; } </style>
A complete practice snippet that shows how the HTML behaves in context.
A weak pattern from the lesson. Use it as a warning sign when reviewing real pages.
<meta name="description" content="Best website, cheap, fast, amazing, number one."> <meta name="keywords" content="html,html,html,html tutorial">
A recognizable mistake you can search for and refactor.
Rules that matter
Layout-focused HTML is strongest when meaning, grouping, metadata and behavior hooks all have a clear reason to exist.
A meta description should summarize this exact page.
Modern SEO is not won by repeating keywords in meta tags.
It is essential for normal mobile behavior.
Do not accidentally noindex pages that should rank.
Large sites should generate unique page descriptions.
Open Graph and Twitter tags should match the real page content.
Production thinking
This matters because metadata decides how a page behaves before someone even reads the content.
Meta viewport affects zoom and mobile usability. Avoid settings that block user scaling.
Metadata should be part of a launch checklist, especially for SEO landing pages and shareable content.
The description is not a magic ranking lever, but it strongly affects search result clarity and click-through.
Live code lab
Edit the HTML or CSS, then use Run to refresh the preview. The preview is isolated, so links and forms stay inside this practice area.
Mini assignment
Practice assignment
Try it yourself
Self-check
Do not only read this page. Answer these questions out loud or write the answers in your own notes. If one answer feels vague, revisit the examples before moving on.