HTML content Attribute

Description

The content attribute in HTML is used in conjunction with the <meta> tag, providing important metadata about the web page. This attribute plays a crucial role in defining the page's character set, description, keywords, author of the document, and more. Its value is a string that represents the information or value assigned to the element specified by the name or http-equiv attributes in the same <meta> tag.

For instance, when the name attribute is set to "description," the content attribute contains a brief summary of the page's content. This summary can influence how search engines understand and display the page in search results. Similarly, when the name attribute is set to "keywords," the content attribute lists keywords relevant to the page, which used to help search engines in indexing, though its importance has diminished over time.

Additionally, the content attribute can specify the document's character encoding when used with <meta charset="">. This ensures that the browser correctly displays the text on the webpage, especially when non-English characters are involved.

The correct usage of the content attribute enhances SEO (Search Engine Optimization), accessibility, and the overall user experience by ensuring that browsers and search engines accurately interpret and represent the page's content.

Syntax

<meta name="value" content="text">

Values

  • textAn alphanumeric string value.

Applies To

The content attribute can be used on the following html elements.

Example

&lt;meta name="description" content="This is a description of the webpage content."&gt;

Browser Support

The following table will show you the current browser support for the HTML content Attribute.

Desktop
Edge Chrome Firefox Opera Safari
121112.14
Tablets / Mobile
Chrome Firefox Opera Safari Samsung Webview
18412.13.214.4

Last updated by CSSPortal on: 28th March 2024