<meta>
Description
The <meta>
element includes
additional HTTP header information about the document.
This element is placed in the <head>
section of the document.
The name attribute specifies which metadata type. The content attribute to provide a value.
The following table lists the predefined metadata types:
Metadata Name | Description |
---|---|
application name | The name of the web application |
author | The name of the author |
description | A description of the page |
generator | The name of the software that generated the HTML |
keywords | A set of comma-separated strings that describe the content of the page |
<meta name="author" content="your Name">
<meta name="description" content="books.">
<meta name="generator" content="Hand">
<meta name="keywords" content="art, oils, landscape">
Example
The following code specifies name/value metadata pairs.
<!DOCTYPE HTML>
<html>
<head>
<meta name="author" content="java2s.com"/>
<meta name="description" content="A simple example"/>
</head><!--from www.j av a 2 s .co m-->
<body>
<a href="http://java2s.com">Visit java2s.com</a>
</body>
</html>
The code above generates the following result.
Simulate an HTTP Header
The meta
element can override the value of one of the HTTP (Hypertext Transfer Protocol) headers.
The http-equiv attribute specifies which header you want to simulate.
The content attribute provides the value.
There are three permitted values for the http-equiv attribute:
Attribute Value | Description |
---|---|
refresh | ]]> |
default-style | specifies the preferred stylesheet. The value of the content attribute must match the title attribute on a script or link element in the same page. |
content-type | ]]> |
<meta http-equiv="content-type" content="text/html; charset=ISO646-US">
<meta http-equiv="default-style" content="stylesheet">
<meta http-equiv="refresh" content="3">
<meta http-equiv="refresh" content="3;url=http://www.java2s.com">
The following code specifies to the refresh(reload) the page every five seconds.
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="refresh" content="5" />
</head><!-- w w w.j av a 2 s . c o m-->
<body>
<a href="http://java2s.com">Visit java2s.com</a>
</body>
</html>
The code above generates the following result.