metadata

<meta>

Provides metadata about the document that other tags cannot express — charset, viewport, description, robots directives, and Open Graph tags. Placed only inside <head>.

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

Common attributes

Attribute Purpose
charset Document encoding — always utf-8
name Metadata name: viewport, description, robots, theme-color, author
content Value for the given name or http-equiv
http-equiv HTTP-header equivalent: content-security-policy, refresh, x-ua-compatible
property Open Graph key like og:title, og:image

Examples

<meta charset="utf-8">

Must be the first tag in <head>

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

Enables responsive layout on mobile

<meta name="description" content="Learn HTML tags with examples.">

Search-result snippet

<meta property="og:image" content="https://utilko.com/og.png">

Open Graph preview image for social shares

Gotcha

must appear within the first 1024 bytes of the document — put it first in . is a void element: no closing tag.

Related tags

← All HTML tags · CSS selectors · HTML entities