HTML content Attribute
The HTML content attribute provides the value associated with metadata defined by a <meta> element. Its meaning and expected value depend on the accompanying name, http-equiv, or itemprop attribute.
Syntax
The content attribute is specified on a <meta> element. The accompanying attribute determines what the content value represents.
<meta name="description" content="A beginner-friendly guide to HTML.">
In this example, name="description" identifies the type of metadata and content supplies its value.
Attribute Value
The content attribute accepts a string. The required format and meaning of that string depend on the type of metadata or pragma directive being defined.
| Value | Description |
|---|---|
| String | Provides the value of the metadata or pragma directive represented by the <meta> element. |
Elements That Use the content Attribute
The content attribute applies to the <meta> element when it provides document metadata, a pragma directive, or metadata associated with itemprop.
| Element | Description |
|---|---|
<meta> |
Provides the value associated with metadata defined by name, http-equiv, or itemprop. |
Using content with name
When a <meta> element uses the name attribute, the name identifies the metadata and content supplies its value.
<meta name="description" content="Learn the fundamentals of HTML and CSS.">
<meta name="author" content="KD Web Hosting & Design">
For example, name="description" identifies a document description, while the corresponding content value contains the description itself.
Using content with http-equiv
When http-equiv is used, the content attribute supplies the value for the pragma directive.
<meta http-equiv="refresh" content="30">
This example instructs the browser to refresh the document after 30 seconds. The syntax and meaning of the content value depend on the particular http-equiv keyword.
Automatic refreshes and redirects should be used carefully because unexpected page changes can create accessibility and usability problems.
Using content with itemprop
A <meta> element can also use itemprop with content to provide a machine-readable value as part of HTML microdata.
<meta itemprop="datePublished" content="2026-09-19">
In this case, itemprop identifies the property and content supplies its value.
content and charset
The modern character encoding declaration uses the charset attribute directly and does not use content.
<meta charset="utf-8">
When a <meta> element has the charset attribute, the content attribute must not also be specified on that element.
Common Mistakes
Do not confuse the content attribute with visible page content. Metadata supplied through <meta> is not normally displayed as part of the document's rendered body.
<meta name="description" content="A guide to learning HTML.">
Do not assume every content value follows the same format. The expected value depends on the accompanying name, http-equiv, or itemprop.
Do not add content to a modern <meta charset="utf-8"> declaration. The character encoding is supplied directly by the charset attribute.
Browser Support
Baseline: Widely available indicates a feature has been supported by core browsers for at least 30 months. At this stage, the feature is considered stable and safe for most websites to use without needing to worry about compatibility issues or fallbacks, as it is supported by the vast majority of users' devices and browser versions.
The content attribute on the <meta> element is widely supported in current core browsers.
Checking Browser Support
For current browser compatibility information, visit Can I Use? . Search for the HTML element or attribute you want to check. You can also narrow your search by entering an element name and attribute name separated by a colon. Search results can include related HTML features, element attributes, input types, APIs, and other technologies, so select the result that most closely matches the feature you are checking.
Try the content Attribute
The example includes several <meta> elements in the document head. View the HTML source in the editor to see how content supplies values for different types of document metadata.
Summary
The HTML content attribute provides the value associated with a <meta> element. It is used with name, http-equiv, or itemprop, and the meaning and required format of its value depend on the metadata being defined. A modern <meta charset> declaration does not use the content attribute.
