Introduction to Meta Tag in HTML
A meta tag in HTML is used to define data about your webpage or HTML document. With the help of a meta tag, one can define the description of the document, its author information when it was last updated, it uses to give details properties of the HTML document. Meta tag is defined within the <meta> HTML tag, which included in <head> part. It is most useful to the web designers to showing the actual display part of the web page. Whole viewport control will be done by them using meta tags in HTML 5. The meta tag is referred by most of the browsers for many useful features like refreshing pages, displaying web pages content and web services used by them.
Meta tag used in the head section as follows:
In the above syntax it status that, charset=”utf-8” provides the best support for displaying any kind of language.
Here is another syntax for meta tag with some value is:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
It is used to handle the size of the viewport with all its page dimension value and page scrolling to fit our webpage perfectly in any kind of device.
List of Meta tag in HTML
There are different types of Meta tags used in HTML, let’s see one by one:
1. <meta charset=”UTF-8″> This is very basic meta tag used to define any kind of language.
2. <meta name=”description” content=”150 words”> It is used to define your content’s description up to 150 words.
3. <meta name=”copyright” content=”company name”> It is used to preserve all copyrights of defined company.
4. <meta name=”abstract” content=””> It is used to define abstract of specific webpage.
5. <meta name=”author” content=”name, email@example.com”> It is used to define author of your HTML document.
6. <meta name=”url” content=”http://www.websiteaddrress.com”> It is used to define URL address of specific company defined in tag attribute.
7. <meta name=”rating” content=”General”> It is used to handle ratings which comes on our document.
8. <meta name=”subtitle” content=” subtitle using metatag”> If we want to define subtitle for our HTML documents then it made possible using this tag.
9. <meta name=”refresh” content=”50″> It is used to refresh our webpage at its defined time spam.
10. <meta name=”Classification” content=”Business”> It is used to classify our document at defined entity value.
11. <meta name=”keywords” content=”your, tags”/> This tag is used to specify some keywords in Meta tag, so it’s made possible to search this content easily in our document.
12. <meta name=”summary” content=””> This tag is used to define summary of our document.
Working of Meta tag in HTML
Meta tag in HTML is mainly used to include machine-readable information in our webpage document which is actually invisible on the webpage. Another most important working of this tag in HTML is, with the help of this tag one can easily redirect to the other webpage using this meta tag feature.
There is some attributes list on which meta tag works finely are as follows:
1. Content: Content in the meta tag works like value for its included meta tag.
2. Name: Name works as property for meta tag. It comes in the form of details, owner, keywords, etc.
3. http-equiv: This attribute used to define header details in the document.
4. Charset: It is the main attribute in the Meta tag used to define character encoding for declaration purpose into its document.
5. Scheme: this attribute is used to define the scheme in which the actually meta tag is going to be used. But this type of attribute is not supported in HTML5.
Examples on Meta Tag in HTML
Let’s see some examples
We are going to use the Meta tag and it will read by the computer system but not able to see anything to the visitors of the webpage.
<meta name="description" content="Meta tag details information here">
<meta name="robots" content="Robotics"/>
<meta name="hotmail:card" content="summary"/>
Output: It will show a blank screen as an output.
Here is this example we are going to use different kinds of Meta tags and will show the output, the webpage will be refresh at every specific time as well as it will store cookies for your page also mentioning its expiry date too.
<title>Meta Tags Example</title>
<meta name = "keywords" content = "HTML, Meta Tags, Metadata" />
<meta name = "description" content = "Learning about Meta Tags." />
<meta http-equiv = "cookie" content = "userid = xyz;
expires = Tuesday, 31-Dec-19 23:59:59 IST;" />
<meta name = "revised" content = "EDUCBA -Online courses, 3/7/2019" />
<meta http-equiv = "refresh" content = "5" />
<h2>Become an Awesome Design Expert</h2>
<p>EDUCBA- All about online certification courses</p>
<h4>Learn Graphic designing, Animation, Game Development, Video Editing & more with our Online Certification Courses</h4>
<p>Choose your interest area and get certified with our online Courses in Finance, Data Science, Software Development, Excel, Design, Project Management, Personal Development, Marketing and Human Resources.</p>
Output: The webpage shown in output will refresh every 5 seconds.
Let’s see another example using meta tags, it will reflect same as above but after refreshing the webpage it will redirect to another webpage which URL’s will be mentioned in Meta tag as shown in below HTML code:
<title>Meta Tags in HTML 5</title>
<meta name = "keywords" content = "HTML 5, Meta Tag" />
<meta name = "description" content = "Detail description of Meta Tags in
<meta http-equiv = "refresh" content = "10; url = https://www.educba.com/" />
<p>EDUCBA- All about online certification courses</p>
So, a Meta tag in Html is used to define metadata about HTML documents. The code included in it is a machine-readable format that works good with a webpage but doesn’t show any content on the page to the visitors. Meta tag containing 3 different types of attributes like global, element-specific and event handler attributes.
This is a guide to Meta Tag in HTML. Here we discuss the list of different types of Meta tags used in HTML along with the examples. You may also look at the following articles to learn more –