Meta Tag in HTML
Sep 04, 2024 pm 04:20 PMA 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:
<html> <head> <meta charset="UTF-8"> <meta name="description" content="Meta tag details information here"> <meta name="robots" content="Robotics"/> <meta name="hotmail:card" content="summary"/> </head> </html>
Output: It will show a blank screen as an output.
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:
<html> <head> <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" /> </head> <body> <h1>EDUCBA</h1> <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> </body> </html>
Output: The webpage shown in output will refresh every 5 seconds.
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:
<head> <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/" /> </head> <body> <p>EDUCBA- All about online certification courses</p> </body>
Output:
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!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The web page structure needs to be supported by core HTML elements. 1. The overall structure of the page is composed of , , which is the root element, which stores meta information and displays the content; 2. The content organization relies on title (-), paragraph () and block tags (such as ,) to improve organizational structure and SEO; 3. Navigation is implemented through and implemented, commonly used organizations are linked and supplemented with aria-current attribute to enhance accessibility; 4. Form interaction involves , , and , to ensure the complete user input and submission functions. Proper use of these elements can improve page clarity, maintenance and search engine optimization.

When using HTML5SSE, the methods to deal with reconnection and errors include: 1. Understand the default reconnection mechanism. EventSource retrys 3 seconds after the connection is interrupted by default. You can customize the interval through the retry field; 2. Listen to the error event to deal with connection failure or parsing errors, distinguish error types and execute corresponding logic, such as network problems relying on automatic reconnection, server errors manually delay reconnection, and authentication failure refresh token; 3. Actively control the reconnection logic, such as manually closing and rebuilding the connection, setting the maximum number of retry times, combining navigator.onLine to judge network status to optimize the retry strategy. These measures can improve application stability and user experience.

Doctype is a statement that tells the browser which HTML standard to use to parse the page. Modern web pages only need to be written at the beginning of the HTML file. Its function is to ensure that the browser renders the page in standard mode rather than weird mode, and must be located on the first line, with no spaces or comments in front of it; there is only one correct way to write it, and it is not recommended to use old versions or other variants; other such as charset, viewport, etc. should be placed in part.

Client-sideformvalidationcanbedonewithoutJavaScriptbyusingHTMLattributes.1)Userequiredtoenforcemandatoryfields.2)ValidateemailsandURLswithtypeattributeslikeemailorurl,orusepatternwithregexforcustomformats.3)Limitvaluesusingmin,max,minlength,andmaxlen

Use tags in HTML to group options in the drop-down menu. The specific method is to wrap a group of elements and define the group name through the label attribute, such as: 1. Contains options such as apples, bananas, oranges, etc.; 2. Contains options such as carrots, broccoli, etc.; 3. Each is an independent group, and the options within the group are automatically indented. Notes include: ① No nesting is supported; ② The entire group can be disabled through the disabled attribute; ③ The style is restricted and needs to be beautified in combination with CSS or third-party libraries; plug-ins such as Select2 can be used to enhance functions.

To use HTML button elements to achieve clickable buttons, you must first master its basic usage and common precautions. 1. Create buttons with tags and define behaviors through type attributes (such as button, submit, reset), which is submitted by default; 2. Add interactive functions through JavaScript, which can be written inline or bind event listeners through ID to improve maintenance; 3. Use CSS to customize styles, including background color, border, rounded corners and hover/active status effects to enhance user experience; 4. Pay attention to common problems: make sure that the disabled attribute is not enabled, JS events are correctly bound, layout occlusion, and use the help of developer tools to troubleshoot exceptions. Master this

When using HTML5Geolocation API to obtain user location, you must first obtain user authorization, and request and explain the purpose at the right time; the basic method is navigator.geolocation.getCurrentPosition(), which contains successful callbacks, wrong callbacks and configuration parameters; common reasons for failure include permission denied, browser not supported, network problems, etc., alternative solutions and clear prompts should be provided. The specific suggestions are as follows: 1. Request permissions when the user operation is triggered, such as clicking the button; 2. Use enableHighAccuracy, timeout, maximumAge and other parameters to optimize the positioning effect; 3. Error handling should distinguish between different errors

Using HTML5 semantic tags and Microdata can improve SEO because it helps search engines better understand page structure and content meaning. 1. Use HTML5 semantic tags such as,,,, and to clarify the function of page blocks, which helps search engines establish a more accurate page model; 2. Add Microdata structured data to mark specific content, such as article author, release date, product price, etc., so that search engines can identify information types and use them for display of rich media summary; 3. Pay attention to the correct use of tags to avoid confusion, avoid duplicate tags, test the effectiveness of structured data, regularly update to adapt to changes in schema.org, and combine with other SEO means to optimize for long-term.
