HTML Tag


The <meta> element in HTML is used to describe metadata i.e. the description, keywords, document’s author, etc. This metadata won’t be displayed on the page, but is used by the search engines, web browsers, etc.

Now, you can also set the viewport under <meta> to set the dimensions of the web page −

<meta name="viewport" content="width=device-width, initial-scale=1.0">

Following are the attributes −

Sr.NoType & Description
1Name
Name for the property. Can be anything. Examples include, keywords, description, author, revised, generator etc.
2content
Specifies the property's value.
3scheme (deprecated)
Specifies a scheme to interpret the property's value (as declared in the content attribute).
4http-equiv
Used for http response message headers. For example, http-equiv can be used to refresh the page or to set a cookie. Values include content-type, expires, refresh and set-cookie.
5charset
The character encoding.

Example

Let us now see an example to implement the <meta> tag −

 Live Demo

<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Learn for free">
<meta name="keywords" content="Video tutorials, free tutorials, learn, web">
<meta http-equiv="refresh" content="20">
<meta name="author" content="Jack Sparrow">
</head>
<body>
<h2>Tutorials</h2>
<p>Programming tutorials for free:</p>
<ol>
<li>Java</li>
<li>C++</li>
<li>C</li>
<li>C#</li>
</ol>
</body>
</html>

Output

This will produce the following output −

Updated on: 17-Sep-2019

69 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements