<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 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">
  

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 ValueDescription
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-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 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  

Tag:
  1. <a>
  2. <acronym>
  3. <address>
  4. <area>
  5. <article>
  6. <aside> for SideBar
  7. <audio>
  8. <b>
  9. <base>
  10. <bdi>
  11. <bdo>
  12. <blockquote>
  13. <body>
  14. <br>
  15. <button>
  16. <canvas>
  17. <caption>
  18. <cite>
  19. <code>
  20. <col>
  21. <colgroup>
  22. <dd>
  23. <del>
  24. <details> for expandable section
  25. <dfn>
  26. <div>
  27. <dl>
  28. <!DOCTYPE>
  29. <dt>
  30. <em>
  31. <embed>
  32. <fieldset>
  33. <figure> for content with caption
  34. <footer> for footers
  35. <form>
  36. <frame>
  37. <frameset>
  38. <head>
  39. <header> for headers
  40. <hgroup> for header grouping
  41. <hN>
  42. <hr>
  43. <html>
  44. <i>
  45. <iframe>
  46. <img>
  47. <input>
  48. <ins>
  49. <kbd>
  50. <keygen>
  51. <label>
  52. <legend>
  53. <li>
  54. <link>
  55. <mark> to highlight
  56. <map>
  57. <meta>
  58. <meter>
  59. <nav> for navigation
  60. <noscript>
  61. <object>
  62. <ol>
  63. <output>
  64. <optgroup>
  65. <option>
  66. <p>
  67. <param>
  68. <pre>
  69. <progress>
  70. <q>
  71. <ruby>, <rt>, and <rp> Elements
  72. <rt>
  73. <ruby>
  74. <samp>
  75. <script>
  76. <section> marks sections
  77. <select>
  78. <span>
  79. <strong>
  80. <style>
  81. <sub>
  82. <sup>
  83. <table>
  84. <tbody>
  85. <td>
  86. <textarea>
  87. <tfoot>
  88. <thead>
  89. <th>
  90. <time> for date and time
  91. <title>
  92. <tr>
  93. <ul>
  94. <var>
  95. <video>
Related: