HTML - Meta Tags
What are HTML Meta Tags
HTML allows you to list out metadata which is extra important info about a particular document in a number of ways. The Meta element is to be used to add name or value pairs showing qualities of the particular HTML document, like the author, a list of keywords, expiry date, and the document author, etc.
The HTML <meta> tag is mainly used to list out such extra information. This HTML tag is a void element and so it does not have a close tag, it also holds details in between its attributes.
You can put in a single or more meta tags in your HTML document that is based on the certain information you want to place in your HTML document but generally, meta tags do not have an impact on the physical appearance of the document. So from the appearance point of view, it does not really matter if you add them or not.
Adding Meta Tags to Your Documents
You can add metadata to your HTML web pages by just adding the <meta> tags inside the header of the HTML document. The header of the HTML document is written as an opening <head> tag and closing </head> tag. A meta HMTML tag can have any of the following attributes as a piece of extra information to its core attributes, these attributes are listed in below:
1. Name: The name of the property and it could be anything. Examples of names include keywords, description, author, revised, generator, etc.
2. Content: responsible for Specifies the property's value.
3. Scheme: responsible for specifying a scheme in other to interpret the property's value (as specified in the content HTML attribute).
4. http-equiv: This is responsible for http response message headers. For instance, http-equiv can be used to refresh the page or to set a cookie. Values include content-type, expires, refresh and set-cookie.
Specifying Keywords
You can make use of the <meta> tag to list out important keywords that are related to the particular document and then these specified keywords can be used for Search Engine Optimization (SEO). So that those words can be used to search for your web page. Below is an example of how to use a meta tag.
Example
<!DOCTYPE html> <html> <head> <title>Meta Tags Example</title> <meta name = "keywords" content = "HTML, Meta Tags, Metadata" /> </head> <body> <p>Hello HTML5!</p> </body> </html>
This above code will display as:
Document Description
You can make use of the HTML <meta> tag for the purpose of giving an informative and description of the document. This can also be used for Search Engine Optimization (SEO). So that the description can be used to search for your web page. Below is an example of how to use a meta tag and the description attribute.
Example
<!DOCTYPE html> <html> <head> <title>Meta Tags Example</title> <meta name = "keywords" content = "HTML, Meta Tags, Metadata" /> <meta name = "description" content = "Learning about Meta Tags." /> </head> <body> <p>Hello HTML5!</p> </body> </html>
Document Revision Date
You can make use of the <meta> tag to provide information about the last time that the HTML document was updated. This information can be displayed by various web browsers while refreshing your webpage.
Example
<!DOCTYPE html> <html> <head> <title>Meta Tags Example</title> <meta name = "keywords" content = "HTML, Meta Tags, Metadata" /> <meta name = "description" content = "Learning about Meta Tags." /> <meta name = "revised" content = "Tutorialspoint, 3/7/2014" /> </head> <body> <p>Hello HTML5!</p> </body> </html>