content

HTML content attributes provide additional information about an element, defining its behavior or appearance, such as src, href, and alt.

content attribute

The content attribute in HTML is primarily used with the <meta> tag to define metadata, such as the page description , keywords , or author. It works alongside the name or http-equiv attributes to provide meaningful information about the webpage.

Syntax

index.html
<meta name="value" content="text">

Example

The meta elements in this document define its description and keywords.

index.html
<!DOCTYPE html>
<html>
<head>
  <meta name="description" content="Free Web tutorials">
  <meta name="keywords" content="HTML, CSS, XML, JavaScript">
</head>
<body>
  <p>The meta elements in this document define its description and keywords.</p>
</body>
</html>
The content attribute provides essential metadata such as the page description , keywords, and author details.

Applies To

The content attribute is used with the following element:

ElementAttribute
<meta>content

Conclusion

The content attribute plays a key role in defining metadata, enhancing SEO, and improving browser behavior. Primarily used within the <meta> tag, it helps provide information such as descriptions, keywords, and authorship. Utilizing the content attribute effectively allows developers to optimize webpages for search engines and enhance accessibility.