Preparation
🌐 ⏐ HTML5 Questions
5. Meta Tags

Meta Tags and Uses

A meta tag is a hidden piece of code tucked inside a webpage's head section. They provide information about the webpage to search engines and browsers, but aren't directly visible to users on the page itself.
Think of them as little labels describing the content.

<meta charset="UTF-8">

<meta charset="UTF-8" />

The <meta charset="UTF-8"> tag specifies the character encoding for the HTML document. It ensures proper rendering of special characters and symbols across different browsers and devices.

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<meta name="viewport" content="width=device-width, initial-scale=1.0" />

The <meta name="viewport"> tag controls the layout and scaling of the webpage on mobile devices. Setting width=device-width ensures the page width matches the device width, and initial-scale=1.0 sets the initial zoom level.

<meta name="description" content="Brief description of the webpage">

<meta name="description" content="Brief description of the webpage" />

The <meta name="description"> tag provides a brief summary or description of the webpage's content. It's often used by search engines as a snippet in search results to inform users about the page.

<meta name="keywords" content="keyword1, keyword2, keyword3">

<meta name="keywords" content="keyword1, keyword2, keyword3" />

The <meta name="keywords"> tag specifies keywords or phrases relevant to the webpage's content. While not as important for SEO as it used to be, some search engines may still consider them when indexing the page.

<meta name="author" content="Author Name">

<meta name="author" content="Author Name" />

The <meta name="author"> tag identifies the author or creator of the webpage's content. It's useful for providing attribution and establishing credibility.

<meta name="robots" content="index, follow">

<meta name="robots" content="index, follow" />

The <meta name="robots"> tag instructs search engine crawlers on how to index and follow links on the webpage. index allows indexing of the page, while follow allows following of links.

<meta http-equiv="refresh" content="5;url=https://example.com">

<meta http-equiv="refresh" content="5;url=https://example.com" />

The <meta http-equiv="refresh"> tag redirects the webpage to another URL after a specified time interval (in seconds). It's commonly used for automatic page redirects or to refresh content periodically.

<meta name="og:title" content="Page Title">

<meta name="og:title" content="Page Title" />

The Open Graph <meta> tags, such as <meta name="og:title">, are used to control how content appears when shared on social media platforms like Facebook. They specify metadata for better presentation of shared content.

These meta tags provide essential metadata for HTML documents, influencing how they are displayed, indexed, and shared on the web.