Open In App

HTML content Attribute

Last Updated : 28 Aug, 2024
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Share
Report
News Follow

The HTML content Attribute is given the values related to the http-equiv or name attribute. The content attribute can associated with the <meta> element. 

Note: This attribute is depreciated from HTML 5.

Supported Tags: 

  • <meta>

Syntax:  

<meta content="text">

Attribute Values: It contains the text’s values that specify the meta information’s content.

Example: This Example illustrates the use of content attribute. 

<!DOCTYPE html>
<html>

<head>
    <title>
      content attribute in HTMLs
  </title>
    <meta name="keywords"
          content="content attribute
                   in Meta Tag, Metadata" />
</head>

<body style="text-align:center;">
    <h1> GeeksforGeeks</h1>
    <h2>Content Attribute In HTML</h2>
</body>

</html>

Output: 


Supported Browsers: The browser supported by HTML content Attribute are listed below: 

HTML content Attribute – FAQs

Which HTML tag is most commonly associated with the content attribute?

The content attribute is most commonly used with the <meta> tag to provide metadata for web pages.

How do you use the content attribute with the <meta> tag for SEO?

To improve SEO, the content attribute is used with <meta name=”description”> to provide a brief summary of the page, and with <meta name=”keywords”> to specify relevant keywords.

How does the content attribute affect social media sharing?

The content attribute is used with Open Graph tags (e.g., <meta property=”og:description” content=”Your description here”>) to control how content appears when shared on social media.

Can the content attribute be used to set the viewport for responsive design?

Yes, the content attribute is used with <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> to control viewport settings for responsive web design.

How do you specify a character set using the content attribute?

The content attribute can be used with <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″> to specify the character encoding of a webpage.


Next Article

Similar Reads

three90RightbarBannerImg