search

Meta Tag in HTML

Sep 04, 2024 pm 04:20 PM
htmlhtml5HTML TutorialHTML PropertiesHTML tags

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 detailed properties of the HTML document. Meta tag is defined within the HTML tag, which included in

part. It is most useful to the web designers to show the actual display part of the web page. The whole viewport control will be done by them using meta tags in HTML 5. The meta tag is referred to by most of the browsers for many useful features like refreshing pages, displaying web pages content, and web services used by them.

Syntax

Meta tag used in the head section as follows:

<meta charset="utf-8">

In the above syntax, it states 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 on 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. This is a very basic meta tag used to define any kind of language.

2.  It is used to define your content’s description up to 150 words.

3.  It is used to preserve all copyrights of defined company.

4.  It is used to define abstract of specific webpage.

5.  It is used to define author of your HTML document.

6.  It is used to define URL address of specific company defined in tag attribute.

7.  It is used to handle ratings which comes on our document.

8.  If we want to define subtitle for our HTML documents then it made possible using this tag.

9.  It is used to refresh our webpage at its defined time spam.

10.  It is used to classify our document at defined entity value.

11.  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.  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 work 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 purposes in its document.

5. Scheme: this attribute is used to define the scheme in which the actual 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

Example #1

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.

HTML code:


<meta charset="UTF-8">
<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.

Meta Tag in HTML

Example #2

Here is this example we are going to use different kinds of Meta tags and show the output; the web page will be refresh at every specific time and store cookies for your page, also mentioning its expiry date.

HTML code:


<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">


<h1 id="EDUCBA">EDUCBA</h1>
<h2 id="Become-an-Awesome-Design-Expert">Become an Awesome Design Expert</h2>
<p>EDUCBA- All about online certification courses</p>
<h4 id="Learn-Graphic-designing-Animation-Game-Development-Video-Editing-amp-more-with-our-Online-Certification-Courses">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.

Meta Tag in HTML

Example #3

Let’s see another example using meta tags, it will reflect the same as above, but after refreshing the webpage, it will redirect to another webpage which URL’s will be mentioned in the Meta tag as shown in the below HTML code:

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
HTML 5.">
<meta http-equiv="refresh" content="10; url = https://www.educba.com/">


<p>EDUCBA- All about online certification courses</p>

Output:

Meta Tag in HTML

Meta Tag in HTML

Conclusion

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 well 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.

The above is the detailed content of Meta Tag in HTML. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
HTML, CSS, and JavaScript: Examples and Practical ApplicationsHTML, CSS, and JavaScript: Examples and Practical ApplicationsMay 09, 2025 am 12:01 AM

The roles of HTML, CSS and JavaScript in web development are: 1. HTML is used to build web page structure; 2. CSS is used to beautify the appearance of web pages; 3. JavaScript is used to achieve dynamic interaction. Through tags, styles and scripts, these three together build the core functions of modern web pages.

How do you set the lang attribute on the  tag? Why is this important?How do you set the lang attribute on the tag? Why is this important?May 08, 2025 am 12:03 AM

Setting the lang attributes of a tag is a key step in optimizing web accessibility and SEO. 1) Set the lang attribute in the tag, such as. 2) In multilingual content, set lang attributes for different language parts, such as. 3) Use language codes that comply with ISO639-1 standards, such as "en", "fr", "zh", etc. Correctly setting the lang attribute can improve the accessibility of web pages and search engine rankings.

What is the purpose of HTML attributes?What is the purpose of HTML attributes?May 07, 2025 am 12:01 AM

HTMLattributesareessentialforenhancingwebelements'functionalityandappearance.Theyaddinformationtodefinebehavior,appearance,andinteraction,makingwebsitesinteractive,responsive,andvisuallyappealing.Attributeslikesrc,href,class,type,anddisabledtransform

How do you create a list in HTML?How do you create a list in HTML?May 06, 2025 am 12:01 AM

TocreatealistinHTML,useforunorderedlistsandfororderedlists:1)Forunorderedlists,wrapitemsinanduseforeachitem,renderingasabulletedlist.2)Fororderedlists,useandfornumberedlists,customizablewiththetypeattributefordifferentnumberingstyles.

HTML in Action: Examples of Website StructureHTML in Action: Examples of Website StructureMay 05, 2025 am 12:03 AM

HTML is used to build websites with clear structure. 1) Use tags such as, and define the website structure. 2) Examples show the structure of blogs and e-commerce websites. 3) Avoid common mistakes such as incorrect label nesting. 4) Optimize performance by reducing HTTP requests and using semantic tags.

How do you insert an image into an HTML page?How do you insert an image into an HTML page?May 04, 2025 am 12:02 AM

ToinsertanimageintoanHTMLpage,usethetagwithsrcandaltattributes.1)UsealttextforaccessibilityandSEO.2)Implementsrcsetforresponsiveimages.3)Applylazyloadingwithloading="lazy"tooptimizeperformance.4)OptimizeimagesusingtoolslikeImageOptimtoreduc

HTML's Purpose: Enabling Web Browsers to Display ContentHTML's Purpose: Enabling Web Browsers to Display ContentMay 03, 2025 am 12:03 AM

The core purpose of HTML is to enable the browser to understand and display web content. 1. HTML defines the web page structure and content through tags, such as, to, etc. 2. HTML5 enhances multimedia support and introduces and tags. 3.HTML provides form elements to support user interaction. 4. Optimizing HTML code can improve web page performance, such as reducing HTTP requests and compressing HTML.

Why are HTML tags important for web development?Why are HTML tags important for web development?May 02, 2025 am 12:03 AM

HTMLtagsareessentialforwebdevelopmentastheystructureandenhancewebpages.1)Theydefinelayout,semantics,andinteractivity.2)SemantictagsimproveaccessibilityandSEO.3)Properuseoftagscanoptimizeperformanceandensurecross-browsercompatibility.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use