HTML Meta Tags
HTML meta tags are HTML elements that provide meta information about your HTML document. HTML meta tags are thus not visible in the browser. The meta information is used by search engines to find out what your HTML page is about.
Meta tags must be located inside the
head element of your HTML document.
Here is how that looks:
<head> <meta name="keywords" content="HTML, Text Formatting Elements"> <meta name="description" content="Describes HTML's text formatting elements"> <meta name="author" content="Jakob Jenkov"> </head>
Inserting a meta tag is done using the
meta element. The
element is an empty element, meaning it has no element body - only attributes.
Here is an example:
<meta name="keywords" content="Dog, cat, pet, kitten, puppy">
A meta tag typically contains two attributes:
name attribute contains the name of the meta information property you
meta element to set a value for.
content attribute sets the value for the meta information property named
There are typically 3 meta information properties that you set for a page, using the meta tags. These are:
Setting values for these 3 meta information properties look like this:
<meta name="keywords" content="HTML, Text Formatting Elements"> <meta name="description" content="Describes HTML's text formatting elements"> <meta name="author" content="Jakob Jenkov">
keywords property tell search engines what keywords are important in your HTML document.
The keywords are separated by commas inside the
It is said that search engines do not look at this field anymore, since a lot of fraud has taken
place in the past, with pages stuffing keywords into the
keywords field which did not match
the content of the HTML document.
description property is normally used by search engines (or Google at least) when displaying
your HTML document in search results. So is the value of the
title element, by the way.
title is displayed, then the
author property tell who the author of the HTML document is.
All meta tags are optional, so it is up to you if you want to use them in your pages.