HTML Meta Information
HTML meta information is used to provide metadata about a web page. Metadata is data about data, and it is used by browsers, search engines, and other web services to understand the content and purpose of the page. Meta information is typically included within the <head> section of an HTML document.
Common Types of Meta Tags
Character Set Declaration
Specifies the character encoding for the HTML document.
Example:
<meta charset="UTF-8">
The most common encoding is UTF-8, which supports most characters from all the world’s writing systems.
Viewport Settings
Controls the layout of the page on mobile browsers.
Example:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
This tag is crucial for responsive web design, ensuring that the page is scaled correctly on different devices.
Page Description
Provides a brief description of the page content, often used by search engines.
Example:
<meta name="description" content="A brief description of the page.">
This description may appear in search engine results, influencing click-through rates.
Keywords
Lists relevant keywords for the page content, used by some search engines.
Example:
<meta name="keywords" content="HTML, CSS, JavaScript, web development">
Keywords are less important for modern SEO but can still provide context.
Author
Specifies the author of the document.
Example:
<meta name="author" content="Saide Hossain">
Robots
Instructs search engine crawlers on how to index the page.
Example:
<meta name="robots" content="index, follow">
Common values:
index, follow: Allows the page to be indexed and followed by search engines.
noindex, nofollow: Prevents the page from being indexed and links from being followed.
Open Graph Tags (for Social Media)
Used to control how content is displayed when shared on social media platforms like Facebook, Twitter, etc.
Examples:
<meta property="og:title" content="Your Page Title"> <meta property="og:description" content="A description of the page content."> <meta property="og:image" content="http://example.com/image.jpg">
These tags improve the appearance of shared links and can increase engagement.
Content-Type
Specifies the media type and character encoding of the document.
Example:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
This tag was more common in older HTML documents but is now often replaced by the <meta charset="UTF-8"> tag.
Refresh
Automatically refreshes the page after a specified time interval.
Example:
<meta http-equiv="refresh" content="30">
This example will refresh the page every 30 seconds.
Custom Meta Tags
You can also create custom meta tags for specific purposes, such as application-specific metadata.
Example:
<meta name="theme-color" content="#ffffff">
This example specifies the theme color of a web app, often used in mobile browsers.
Example of a Complete Head Section with Meta Tags
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content="This is a sample webpage demonstrating the use of HTML meta tags."> <meta name="keywords" content="HTML, Meta Tags, SEO, Web Development"> <meta name="author" content="Saide Hossain"> <meta name="robots" content="index, follow"> <meta property="og:title" content="Learn HTML Meta Tags"> <meta property="og:description" content="A comprehensive guide to HTML meta tags."> <meta property="og:image" content="http://example.com/meta-image.jpg"> <title>HTML Meta Tags Example</title> </head> <body> <h1>Understanding HTML Meta Information</h1> <p>This page explains the different types of meta tags used in HTML.</p> </body> </html>
In this example, the meta tags provide important information about the content, how it should be displayed, and how search engines should treat it.
Read Me…








