Open In App

How to give the value associated with the http-equiv or name attribute in HTML5 ?

Last Updated : 28 Apr, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

The http-equiv and name attribute are specified in the meta tag in an HTML program. The meta tag is included at the head of the HTML document. It is used to define the metadata (data that describes data) about the HTML document. 

There are a lot of different elements under meta, but we will be discussing http-equiv and name attribute.

Definitions:

  1. http-equiv : It sets the information for HTTP response message headers (for example, content). It takes some values like content-security-policy, content-type, default-style, and refresh.
  2. name: It specifies the type/name of the metadata. It has also a bunch of values that we can use as inputs like application-name, author, description, generator, keywords, and viewports.

 When you search on google “geeksforgeeks“, you can notice a description. It is implemented by using the name attribute and by using the content attribute with the respective values to be displayed for the description.

Syntax:

 <meta name="description" 
content="It contains the description for your web application">

google search for geeksforgeeks

HTML code: The HTML program use both the attributes.Comments are added to make you understand in a better way.

HTML




<html lang="en">
  
<!--head tag starts-->
<head>
  
    <meta name="application-name" 
          content="Write the name of the web application">
    <meta name="author" 
          content="Write the name of the author here">
    <meta name="description" 
          content="It contains the description for your web application">
    <meta name="generator" 
          content="Enter the generating software which is used as per 
                   it's corresponding content(like WordPress 3.0, etc)">
    <meta name="keywords" 
          content="keyword1, keyword2, keyword3, keyword4">
    <meta name="viewport" 
          content="width=device-width, initial-scale=1.0">
  
    <!--content-security-policy is used for specifying the content policy-->
    <meta http-equiv="content-security-policy" 
          content="default-src 'self' *.example.com">
  
    <!--content-type is used to specify the encoding, 
        we have used UTF-8 which is used to represent
        any character in Unicode Standard-->
    <meta name="content-type" 
          content="text/html" 
          charset="UTF-8">
  
    <!--default-style is used to specify the preferred stylesheet-->
    <meta http-equiv="default-style" 
          content="The preferred stylesheet which is used">
  
    <!--http-equiv gets the document content refreshed in every 9 seconds-->
    <meta http-equiv="refresh" 
          content="9"
    <title>GFG</title>
  
</head>
<!--head tag ends-->
  
<!--body tag starts -->
<body>
      
    <center>
        <h2 style="color:green">GeeksforGeeks</h2>
        <b>http-equiv Attribute and name Attribute</b><br/>
        <p></p><p></p>
        <div>
          <b> The Webpage Content ...</b>
        </div>
    </center>
     
</body>
<!--body tag ends here-->
</html>


Output: 

example webpage



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments