<meta>
Description:
The <meta> element includes additional HTTP header information about the document. This element is placed in the <head> section of the document.
Syntax:
<meta attributes events>
Specifying Name/Value Metadata Pairs
<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
<meta name="author" content="java2s.com"/>
<meta name="description" content="A simple example"/>
</head>
<body>
<a href="http://java2s.com">Visit java2s.com</a>
</body>
</html>
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">
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.
The following code specifies to the refresh(reload) the page every five seconds.
<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
<meta charset="utf-8" />
<meta http-equiv="refresh" content="5" />
</head>
<body>
<a href="http://java2s.com">Visit java2s.com</a>
</body>
</html>
There are three permitted values for the http-equiv attribute:
Attribute Value | Description |
---|---|
refresh | specifies a period in seconds, after which the current page should reload. You can specify a different URL to be loaded. For example: <meta http-equiv="refresh" content="5; http://www.java2s.com"/> |
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 | This is an alternative way of specifying the character encoding of the HTML page. For example: <meta http-equiv="content-type" content="text/html charset=UTF-8"/> |
Example:
<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">
Home
HTML CSS Book
HTML reference
HTML CSS Book
HTML reference
Tag:
- <a>
- <acronym>
- <address>
- <area>
- <article>
- <aside> for SideBar
- <audio>
- <b>
- <base>
- <bdi>
- <bdo>
- <blockquote>
- <body>
- <br>
- <button>
- <canvas>
- <caption>
- <cite>
- <code>
- <col>
- <colgroup>
- <dd>
- <del>
- <details> for expandable section
- <dfn>
- <div>
- <dl>
- <!DOCTYPE>
- <dt>
- <em>
- <embed>
- <fieldset>
- <figure> for content with caption
- <footer> for footers
- <form>
- <frame>
- <frameset>
- <head>
- <header> for headers
- <hgroup> for header grouping
- <hN>
- <hr>
- <html>
- <i>
- <iframe>
- <img>
- <input>
- <ins>
- <kbd>
- <keygen>
- <label>
- <legend>
- <li>
- <link>
- <mark> to highlight
- <map>
- <meta>
- <meter>
- <nav> for navigation
- <noscript>
- <object>
- <ol>
- <output>
- <optgroup>
- <option>
- <p>
- <param>
- <pre>
- <progress>
- <q>
- <ruby>, <rt>, and <rp> Elements
- <rt>
- <ruby>
- <samp>
- <script>
- <section> marks sections
- <select>
- <span>
- <strong>
- <style>
- <sub>
- <sup>
- <table>
- <tbody>
- <td>
- <textarea>
- <tfoot>
- <thead>
- <th>
- <time> for date and time
- <title>
- <tr>
- <ul>
- <var>
- <video>
Related: