Meta data is data that describes other data and meta tags contain meta data that describes web page data.
The meta data is used by browsers to help them to handle and display web pages.
Meta elements are placed in the head of an HTML document so don't appear on the page.
The meta element supports a number of attributes and the two most important are shown below.
The http-equiv Attribute
This attribute acts like a header and affects the behaviour of the browser in the way that it displays web pages.
Examples of the values that this attribute can be set to are shown below.
Expires. This is used to set an expiry date for the document in the hope that the browser will fetch a fresh version instead of displaying a 'stale' cached version.
It takes the form <meta http-equiv="expires" content="Wed, 4 Feb 2009 09:30:00 GMT"> where the date is in GMT format.
Pragma. This is an instruction to tell the browser not to cache the page and takes the form <meta http-equiv="pragma" content="no-cache">.
Refresh. This is used to tell the browser to load a page at a named URL after a set time.
It takes the form <meta http-equiv="refresh" content="5;url=http://www.somedomain.com"> where the first argument is the delay in seconds before the refresh and the second argument is the URL to load.
The name Attribute
This element doesn't affect the behaviour of the browser but is used to contain information used by some search engines when indexing pages.
Examples of the values that this attribute can be set to are shown below.
Description. This is used to provide a short description of the page contents and will show at the top of the browser and in the search results of some search engines.
It take the form <meta name="description" content="Meta tags, what they are and how they are used.">.
Keywords. This is used to list keywords that are relevant to the content of the page to help search engines with indexing.
It takes the form <meta name="keywords" content="meta tags,html,http-equiv,pragma">.
The keywords attribute has been largely discredited but a relevant description is still used by many search engines so is worthwhile.