meta: The Document-level Metadata element
The <meta> HTML element represents metadata that cannot be represented by other HTML meta-related elements, like <base>, <link>, <script>, <style> or <title>.
Attributes
Specific attributes
Required attributes
content="[content value]" contains the value for the http-equiv or name attribute, depending on which is used.
Allowed attributes
charset="[character encoding]" declares the document’s character encoding. If present, its value must be an ASCII case-insensitive match for “utf-8”.
The new html5 shorthand <meta charset="utf-8"> is not recognized by old browser,
use <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
http-equiv="[directive]" defines a pragma directive. Common values include refresh, default-style, and content-security-policy.
name="[metadata name]" defines the name of a piece of document-level metadata. Common values include description, keywords, author, and viewport.
property="[property name]" defines a property name for Open Graph or other structured metadata.
Global attributes
accesskey Specifies a keyboard shortcut to activate or focus an element.
aria-* Defines accessibility properties and states for assistive technologies.
class Specifies one or more CSS class names for styling the element.
data-* Stores custom data private to the page or application.
dir Sets the text direction (left-to-right, right-to-left, or auto).
hidden Hides the element from display and assistive technologies.
id Defines a unique identifier for the element within the document.
inputmode Hints which virtual keyboard type to display on mobile devices.
itemid Provides a global identifier for microdata items.
itemprop Defines a property name-value pair for microdata.
itemref Associates properties with an item via element IDs for microdata.
itemscope Creates a new microdata item container.
itemtype Specifies the vocabulary URL for microdata items (like Schema.org).
lang Specifies the primary language of the element’s content.
nonce Provides a cryptographic nonce for Content Security Policy.
role Defines the element’s semantic role for accessibility.
tabindex Controls keyboard navigation order and focusability.
title Provides advisory information displayed as a tooltip.
Example
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Personal website of Jane Developer, focused on IndieWeb technologies">
<meta name="author" content="Jane Developer">
<meta property="og:title" content="Jane's Digital Garden">
<meta property="og:description" content="Building the IndieWeb, one website at a time">
<meta property="og:type" content="website">
<meta property="og:url" content="https://jane.example">
</head>