HTML Tutorials‎ > ‎

Meta Tags

What is a <meta> tag? Glad you asked! The <meta> tag is always found at the top of an HTML document  between the <head> and the </head> tag. It has a variety of uses, but one of the most common is used to either reload or redirect pages after a specified amount of time. The reload function is fairly simple, and it looks like this:

<meta http-equiv="Refresh" content="30">

Now, let's break this down. http-equiv gives the name of the http function that you want done by the server and content is the amount of time in seconds you want to wait before the server goes ahead with that function.

If you want to redirect users to another page, you would add the URL to the tag, to tell the server where it should go.

<meta http-equiv="refresh" content="30; url=">

In this case, when the 30 seconds are done, we're redirected to a new page, which is specified by the URL in the tag.

The <meta> tag is also used to convey information about your document that won't be seen anywhere within it, unless you view the source code. Many people use it to add keywords to their pages - which helps control how the page is indexed by search engines.

For Example: <meta name="keywords" content="html, tutorials, web design">

You will need the name element to give the information a name. If you use the <meta> tag several times in one document to do many different things, it's important to keep the tags straight - otherwise you might have trouble remembering what each one does. The content attribute also differs here. Rather than assigning a refresh time, you use this space to add the keywords.

In the above example, your document will be referenced by the additional keywords html, tutorials & web design. Try to use words that relate to your content.

The uses for <meta> tags are continuously expanding, so when I find out more, I'll be sure to let you know.