codescracker


html

HTML Meta Tags



« Previous Tutorial Next Tutorial »


HTML meta tags is generally used to specify metadata (additional information about the document).

The HTML <META> tag appears inside the HEAD tag and has the following five attributes:

HTML META Tag Attributes

The table given below list and describes all attributes of the HTML META tag:

Attribute Value Description
charset character encoding Defines character encoding for the document
contents some_text Defines the content of the meta data
http-equiv content-type
expires,
refresh,
set-cookie
Provides information of the contents attribute to an http header
name author,
description,
keywords,
generator,
revised,
others
Provide the content of the contents attributes

HTML META Tag Example

The following HTML code fragment shows the use of the META tag in a document :

<head>
	<META name="keywords" contents="keyword list"/>
</head>

Here is an example uses HTML META tags:

<!DOCTYPE html>
<html>
<head>
	<title>HTML Meta Tags Example</title>
	<meta name="keywords" content="html, meta, tags, example">
	<meta name="description" content="HTML meta tags tutorial with examples">
	<meta name="author" content="codescracker">
	<meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<meta http-equiv="refresh" content="30">
	<meta http-equiv="expires" content="Wed, 20 June 2018 14:25:27 GMT">
	<meta name="robots" content="noindex, nofollow">
</head>
<body>

<p>Hello, HTML Meta Tags Example!</p>

</body>
</html>

Here is the sample output produced by the above HTML Meta Tags example code:

HTML Meta Tag Example

From the above HTML meta tag example, the

HTML Meta Tag to Give Keywords to Web Page

You can use HTML meta tag to specify keywords for your HTML document. Here is an example using meta tag in specifying keywords for the web page:

<!DOCTYPE html>
<html>
<head>
	<title>HTML Meta Tag (keywords) Example</title>
	<meta name="keywords" content="html,meta,tag,example,tutorial" />
</head>
<body>

<p>Hello, HTML Meta Tag (keywords) Example!</p>

</body>
</html>

Following is the sample output of the above HTML meta tabs to give keywords for a web page example code:

HTML Meta Tags

HTML meta Tag to Give Description to Web Page

You can use HTML meta tag in specifying the description of the HTML document. Here is an example of document description using meta tag in HTML:

<!DOCTYPE html>
<html>
<head>
	<title>HTML Meta Tag (description) Example</title>
	<meta name="description" content="html meta tag tutorial with example" />
</head>
<body>

<p>Hello, HTML Meta Tag (description) Example!</p>

</body>
</html>

Here is the sample output produced by the above HTML meta tag to give description to web page example code:

HTML Meta Tag to give keyword description to webpage

HTML meta Tag to to Give Last Update Time to Web Page

You can use HTML meta tag to specify information about when the HTML document was updated last time. Here is an example show how to specify the last update time of the document in HTML:

<!DOCTYPE html>
<html>
<head>
	<title>HTML Meta Tag (revised) Example</title>
	<meta name="revised" content="codescracker, 7/1/2016" />
</head>
<body>

<p>Hello, HTML Meta Tag (revised) Example!</p>

</body>
</html>

Below is the sample output of the above HTML meta tag to give last update time to web page example code:

HTML Meta Tag to give last update time

HTML meta Tag to Refresh Web Page Automatically after Given Time

You can use HTML meta tag to refresh your web page automatically after given interval of time. Here is an example showing how to refresh web page automatically in every 10 seconds:

<!DOCTYPE html>
<html>
<head>
	<title>HTML Meta Tag (refresh) Example</title>
	<meta http-equiv="refresh" content="10" />
</head>
<body>

<p>Hello, HTML Meta Tag (refresh) Example!</p>

</body>
</html>

Here is the sample output of the above HTML meta tag to refresh web page automatically after a given interval of time example code:

HTML Meta Tag to refresh web page automatically

HTML meta Tag to Redirect Web Page

You can use HTML meta tag to redirect your web page to any other webpage. Here is an example showing how to redirect web page:

<!DOCTYPE html>
<html>
<head>
	<title>HTML Meta Tag (refresh - redirect) Example</title>
	<meta http-equiv="refresh" content="10; url=http://codescracker.com" />
</head>
<body>

<p>Hello, HTML Meta Tag (refresh - redirect) Example!</p>

</body>
</html>

Here is the sample output of the above HTML meta tag to redirect web page example code. This is the initial output:

redirect web page automatically meta tag html

Wait for 10 seconds, after 10 seconds it will be redirected to the specified url. Here it will be redirected to codescracker.com and the Result you will get after 10 second in the browser will be:

HTML Page Redirection Example

HTML meta Tag to Set Cookies

You can use HTML meta tag to specify cookie. Cookies are simply the data that stored inside the small text files on your computer. It is exchanged b/w your web browser and web server to keep track of various information. Here is an example uses meta tag to set cookie in HTML:

<!DOCTYPE html>
<html>
<head>
	<title>HTML Meta Tag (cookie) Example</title>
	<meta http-equiv="cookie" content="userid=xyz; expires=Wednesday, 19-Sept-18 23:59:59 GMT;" />
</head>
<body>

<p>Hello, HTML Meta Tag (cookie) Example!</p>

</body>
</html>

Following is the sample output of the above HTML meta tag to set cookies example code:

HTML Meta Tags Example

HTML meta Tag to Set Author Name

You can use HTML meta tag to set author's name for your web page. Here is an example using meta tag to specify author's name:

<!DOCTYPE html>
<html>
<head>
	<title>HTML Meta Tag (author) Example</title>
	<meta name="author" content="codescracker" />
</head>
<body>

<p>Hello, HTML Meta Tag (author) Example!</p>

</body>
</html>

Here is the sample output produced by the above HTML meta tag to set author name example code:

HTML Meta Tag to give author to webpage

HTML meta Tag to Give Character Set to Web Page

You are free to use meta tag to specify the characters set for the document. Here is an example using meta tag in specifying the character set for the document in HTML:

<!DOCTYPE html>
<html>
<head>
	<title>HTML Meta Tag (Content-Type) Example</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>

<p>Hello, HTML Meta Tag (Content-Type) Example!</p>

</body>
</html>

Here is the sample output of the above HTML meta tag to give character set to a web page example code:

html meta tag to specify character set to webpage

« Previous Tutorial Next Tutorial »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test