<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 NameDescription
application nameThe name of the web application
authorThe name of the author
descriptionA description of the page
generatorThe name of the software that generated the HTML
keywordsA 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>

Click to view the demo

The code above generates the following result.

meta

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 ValueDescription
refresh ]]>
default-stylespecifies 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>

Click to view the demo

The code above generates the following result.

meta




















Home »
  HTML CSS »
    HTML CSS Reference »




HTML Tag Reference
CSS Reference
CSS Selector Reference
Encoding Reference