HTML <meta /> tag


The <meta /> tag is a self closing tag that allows us to send metadata about the data within our HTML file.

The <meta /> tag must reside within the <head></head> element.


<html  xmlns="">
  <title>A Title which will appear in the Windows title bar.</title>

  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />


Required Attributes

content attribute specifies the content of the meta information.

<meta name="Description" content="some text here" />

Optional Attributes

Use the http-equiv attribute or the name attribute, not both.

http-equiv - used to describe an equivalent HTTP-Header and the value we wish to use for it.

<!-- Define methods allowed by server (GET, POST etc) -->
<meta http-equiv="Allow" content="get" />

<!-- Define the the encoding type of the returned data -->
<meta http-equiv="Content-Encoding" content="zip" />

<!-- Define the MIME type for the content -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<!-- Define the document creation date -->
<meta http-equiv="Date" content="aDate" />

<!-- Define the date when a document is to be reloaded -->
<meta http-equiv="Expires" content="aDate" />

<!-- Define the date when a document was last modified -->
<meta http-equiv="Last-Modified" content="aDate" />

<!-- Define an absolute URL for the location of the document -->
<meta http-equiv="Location" content="URL" />

<!-- Define a pages refresh rate (avoid this!) -->
<meta http-equiv="Refresh" content="20" />

<!-- Define a cookie value to set from the content -->
<meta http-equiv="Set-Cookie" content="cookieValue" />

<!-- Define authentication rules (visible security information, not advisable) -->
<meta http-equiv="WWW-Authenticate" content="cookieValue" />

name - used to describe the name of the data in the content attribute and can be any value you choose.

<!-- Define a name for the content -->
<meta name="Description" content="some text here" />

scheme - used to describe the data format or URL, that points to a data format, to apply to the data within the content attribute.

<!-- For example provide the Date Format of the content -->
<meta name="Description" content="01-01-2010" scheme="DD-MM-YYYY" />

Common Attributes


Language Attributes

dir - specifies the directional flow of the content.

<meta dir="ltr" />   <!-- The text will flow from left to right -->
<meta dir="rtl" />   <!-- The text will flow from right to left -->

lang - specifies a language code for the content of the element.

<meta lang="en" />

xml:lang - specifies a language code for the content of the element in XHTML documents.

<meta xml:lang="fr" />

Event Attributes


<menu> tag    << Prev          Next >>  <noframes> tag

go to home page Homepage go to top of page Top