The <meta> Tag in HTML The <meta> tag is an essential part of the HTML document that provides metadata, which is data about data. It is placed within the <head> section of an HTML page. Although metadata itself is not visible on the webpage, it plays a critical role in how search engines, browsers, and other web services interact with and process the webpage.
Search Engines: Metadata helps search engines understand the content and purpose of a webpage, improving its indexing and ranking.
Browsers: Browsers use metadata to render pages correctly and provide information to users (e.g., character encoding).
Web Services: Other services like social media platforms use metadata for displaying previews and other interactions
Description: Defines the character encoding for the document, ensuring it supports various languages and special characters
<meta charset="utf-8">
Description: Provides keywords related to the content of the page. These keywords help search engines index the page.
<meta name="keywords" content="HTML, CSS, JavaScript, Tutorials">
Description: Gives a brief description of the web page. This description often appears in search engine results.
<meta name="description" content="Free Online tutorials">
Description: Specifies the author of the document. This information can be used by content management systems and other tools.
<meta name="author" content="thisauthor">
Description: Instructs the browser to automatically refresh the page after a specified number of seconds.
<meta name="refresh" content="50">
Description: Redirects the user to a different URL after a specified number of seconds.
<meta http-equiv="refresh" content="5; url=https://waytocode.in/">
Description: Controls the viewport's size and scaling on mobile devices, ensuring the web page looks good on all screen sizes.
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="keywords" content="HTML, CSS, JavaScript, Tutorials">
<meta name="description" content="Free Online tutorials for web development.">
<meta name="author" content="John Doe">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="refresh" content="30"> <!-- Refresh the page every 30 seconds
-->
<meta http-equiv="refresh" content="5; url=https://waytocode.in/"> <!--
Redirects to another page after 5 seconds -->
<title>Meta Tag Example</title>
</head>
<body>
<h1>Welcome to the Meta Tag Example</h1>
<p>This page demonstrates the use of various HTML meta tags.</p>
</body>
</html>