Falytom logoFALYTOM
Games
ToolsUI ComponentsServicesProductsAbout
LoginSign Up
menu
  1. Home
  2. /Web Development
  3. /Html
  4. /Meta Tags
Your Progress0%
0 of 76 completed

Topics

Getting Started

  • What is HTML?
  • How the Web Works
  • Setting Up Your Environment
  • Your First HTML Page

HTML Document Structure

  • The DOCTYPE Declaration
  • The HTML Element
  • The Head Section
  • Meta Tags
  • The Body Element
  • HTML Comments

Text and Formatting

  • Headings (h1-h6)
  • Paragraphs
  • Line Breaks and Horizontal Rules
  • Text Formatting (Bold, Italic, etc.)
  • Quotations and Citations
  • Preformatted Text and Code
  • Subscript and Superscript

Links and Navigation

  • Creating Links
  • Absolute vs Relative URLs
  • Link Targets and Attributes
  • Email and Phone Links
  • Internal Page Links

Images and Media

  • Adding Images
  • Image Attributes
  • Image Formats
  • Figure and Figcaption
  • Responsive Images
  • Audio Elements
  • Video Elements
  • Embedding Content

Lists

  • Unordered Lists
  • Ordered Lists
  • Description Lists
  • Nested Lists

Tables

  • Table Basics
  • Table Headers and Footers
  • Spanning Columns and Rows
  • Table Captions
  • Styling Tables

Forms - Part 1 (Basics)

  • Introduction to Forms
  • Text Input Fields
  • Labels and Placeholders
  • Textarea Element
  • Checkboxes
  • Radio Buttons

Forms - Part 2 (Advanced)

  • Select Dropdowns
  • File Upload Inputs
  • HTML5 Input Types
  • Form Validation
  • Form Buttons
  • Fieldsets and Legends
  • Form Accessibility

Semantic HTML

  • What is Semantic HTML?
  • Header and Footer
  • Nav Element
  • Main and Article
  • Section and Aside
  • Div vs Semantic Elements
  • Time and Mark Elements

HTML5 Features

  • HTML5 Overview
  • Canvas Element
  • SVG in HTML
  • Geolocation API
  • Drag and Drop
  • Local Storage
  • Web Workers

Web Accessibility

  • Introduction to Accessibility
  • ARIA Attributes
  • Keyboard Navigation
  • Alt Text Best Practices
  • Color Contrast and Typography
  • Testing for Accessibility

Best Practices & SEO

  • HTML Best Practices
  • SEO Fundamentals
  • Meta Tags for SEO
  • Structured Data

Meta Tags

Essential metadata for SEO, social media, and browser control

Meta tags are snippets of code that provide information about your web page to browsers, search engines, and social media platforms. While invisible to visitors, they play a crucial role in SEO, social sharing, and how your page functions. Let's explore the most important meta tags and how to use them effectively.

What Are Meta Tags?

Meta tags are HTML elements that provide metadataβ€”data about data. They live in the <head> section of your HTML document and don't have closing tags (they're void elements).

MARKUP
<head>
  <meta charset="UTF-8">
  <meta name="description" content="This is a meta tag">
  <meta property="og:title" content="Page Title">
</head>

Meta tags use either the name or property attribute to identify their purpose, and the content attribute to specify their value.

Essential Meta Tags

Let's start with the meta tags that every HTML page should have.

1. Character Encoding (charset)

The charset meta tag specifies the character encoding for your document. This should always be the first meta tag in your head.

MARKUP
<meta charset="UTF-8">

Why it matters:

  • UTF-8 supports all characters from all languages
  • Prevents weird character display issues (like οΏ½ symbols)
  • Allows emojis and special characters πŸŽ‰
  • Required for proper internationalization

🚫 Critical Rule:

The charset meta tag must appear within the first 1024 bytes of your HTML document. Always place it first in the head section!

2. Viewport (Mobile Responsiveness)

The viewport meta tag controls how your page displays on mobile devices. Without it, mobile browsers zoom out to show the full page, making text tiny and hard to read.

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

What each part means:

  • width=device-width: Sets the page width to match the device's screen width
  • initial-scale=1.0: Sets the initial zoom level to 100%

Other Viewport Options

MARKUP
<!-- Prevent user from zooming -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">

<!-- Set maximum zoom level -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0">

<!-- Set minimum zoom level -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=0.5">

⚠️ Accessibility Warning:

Avoid using user-scalable=no or restricting zoom levels. This creates accessibility problems for users with vision impairments who need to zoom in to read content.

SEO Meta Tags

These meta tags help search engines understand and display your content in search results.

3. Meta Description

The meta description provides a brief summary of your page. Search engines often display this in search results.

MARKUP
<meta name="description" content="Learn HTML from scratch with our comprehensive tutorial. Perfect for beginners and covers everything from basic tags to advanced concepts.">

Best practices:

  • Keep it between 150-160 characters
  • Make it compelling and accurate
  • Include relevant keywords naturally
  • Each page should have a unique description
  • Write for humans, not just search engines

4. Meta Keywords (Mostly Obsolete)

Meta keywords were once used to tell search engines what your page is about. However, they're now largely ignored by major search engines due to abuse.

MARKUP
<!-- Still included by some, but not very useful -->
<meta name="keywords" content="HTML, tutorial, web development, coding">

πŸ“ Note:

Google stopped using meta keywords for ranking in 2009. You can skip this tag for modern websites, though it doesn't hurt to include it.

5. Robots Meta Tag

The robots meta tag tells search engines whether to index your page and follow links.

MARKUP
<!-- Allow indexing and following links (default behavior) -->
<meta name="robots" content="index, follow">

<!-- Prevent indexing but allow following links -->
<meta name="robots" content="noindex, follow">

<!-- Allow indexing but don't follow links -->
<meta name="robots" content="index, nofollow">

<!-- Prevent indexing and following links -->
<meta name="robots" content="noindex, nofollow">

<!-- Don't show cached version in search results -->
<meta name="robots" content="noarchive">

<!-- Don't use this page's description -->
<meta name="robots" content="nosnippet">

Common values:

  • index: Allow search engines to index this page
  • noindex: Don't index this page
  • follow: Follow links on this page
  • nofollow: Don't follow links on this page
  • noarchive: Don't show cached version
  • nosnippet: Don't show snippet in search results

6. Author Meta Tag

MARKUP
<meta name="author" content="John Doe">

7. Canonical URL (Link, not Meta)

While not technically a meta tag, the canonical link is crucial for SEO. It tells search engines which version of a page is the "original" when you have duplicate or similar content.

MARKUP
<link rel="canonical" href="https://example.com/original-page">

Open Graph Meta Tags (Social Media)

Open Graph tags control how your page appears when shared on social media platforms like Facebook, LinkedIn, and others.

MARKUP
<!-- Basic Open Graph tags -->
<meta property="og:title" content="Amazing Article Title">
<meta property="og:description" content="A compelling description of the article">
<meta property="og:image" content="https://example.com/image.jpg">
<meta property="og:url" content="https://example.com/article">
<meta property="og:type" content="article">
<meta property="og:site_name" content="My Website">

<!-- For articles -->
<meta property="article:published_time" content="2024-01-15T08:00:00Z">
<meta property="article:author" content="John Doe">
<meta property="article:section" content="Technology">
<meta property="article:tag" content="HTML">

<!-- For videos -->
<meta property="og:video" content="https://example.com/video.mp4">
<meta property="og:video:width" content="1280">
<meta property="og:video:height" content="720">

Essential Open Graph Tags

TagPurpose
og:titleThe title of your page (appears as headline)
og:descriptionBrief description (appears below title)
og:imageImage URL (appears as thumbnail)
og:urlCanonical URL of the page
og:typeType of content (website, article, video, etc.)

Open Graph Image Requirements

  • Minimum size: 200 Γ— 200 pixels
  • Recommended size: 1200 Γ— 630 pixels
  • Aspect ratio: 1.91:1 works best
  • File formats: JPG, PNG, or GIF
  • File size: Under 8 MB (smaller is better)
MARKUP
<!-- Specify image dimensions for better performance -->
<meta property="og:image" content="https://example.com/image.jpg">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:alt" content="Description of the image">

Twitter Card Meta Tags

Twitter has its own set of meta tags for controlling how links appear on Twitter.

MARKUP
<!-- Summary card (default) -->
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@yourusername">
<meta name="twitter:creator" content="@authorusername">
<meta name="twitter:title" content="Page Title">
<meta name="twitter:description" content="Page description">
<meta name="twitter:image" content="https://example.com/image.jpg">

<!-- Summary card with large image -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@yourusername">
<meta name="twitter:title" content="Page Title">
<meta name="twitter:description" content="Page description">
<meta name="twitter:image" content="https://example.com/large-image.jpg">

<!-- Player card (for videos) -->
<meta name="twitter:card" content="player">
<meta name="twitter:player" content="https://example.com/video-player">
<meta name="twitter:player:width" content="1280">
<meta name="twitter:player:height" content="720">

Twitter Card Types

  • summary: Default card with small square image
  • summary_large_image: Large rectangular image (most common)
  • app: For mobile apps with download buttons
  • player: For video/audio players

πŸ’‘ Pro Tip:

If you have Open Graph tags, Twitter will use them as fallback. You can skip Twitter-specific tags for title, description, and image if they're the same as your Open Graph tags.

HTTP-Equiv Meta Tags

These meta tags simulate HTTP headers. They're less commonly used in modern development but still useful in some scenarios.

Page Refresh/Redirect

MARKUP
<!-- Refresh page after 30 seconds -->
<meta http-equiv="refresh" content="30">

<!-- Redirect to another page after 5 seconds -->
<meta http-equiv="refresh" content="5; url=https://example.com/new-page">

⚠️ Note:

Meta refresh for redirects is not recommended. Use server-side redirects (301/302 status codes) instead for better SEO and user experience.

Content-Type

MARKUP
<!-- Old way (HTML4) -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<!-- Modern way (HTML5) - use this instead -->
<meta charset="UTF-8">

X-UA-Compatible (IE Only)

MARKUP
<!-- Force Internet Explorer to use latest rendering engine -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">

This tag is now obsolete since Internet Explorer is discontinued, but you might see it in older code.

Other Useful Meta Tags

Theme Color (Mobile Browser Bar)

MARKUP
<!-- Changes the browser's address bar color on mobile -->
<meta name="theme-color" content="#4285f4">

Application Name

MARKUP
<!-- Name when page is added to home screen -->
<meta name="application-name" content="My App">

Generator

MARKUP
<!-- Identifies software used to build the site -->
<meta name="generator" content="WordPress 6.0">

Referrer Policy

MARKUP
<!-- Control how much referrer information to send -->
<meta name="referrer" content="no-referrer">
<meta name="referrer" content="origin">
<meta name="referrer" content="no-referrer-when-downgrade">

Complete Meta Tags Example

Here's a comprehensive example with all essential meta tags:

index.html
<!DOCTYPE html>
<html lang="en">
<head>
  <!-- Essential meta tags -->
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <!-- Page title -->
  <title>Complete Guide to HTML Meta Tags - Web Dev Tutorial</title>
  
  <!-- SEO meta tags -->
  <meta name="description" content="Learn everything about HTML meta tags including SEO, Open Graph, and Twitter Cards. Comprehensive guide for beginners.">
  <meta name="keywords" content="HTML, meta tags, SEO, Open Graph, Twitter Cards">
  <meta name="author" content="John Doe">
  <meta name="robots" content="index, follow">
  
  <!-- Canonical URL -->
  <link rel="canonical" href="https://example.com/html-meta-tags">
  
  <!-- Open Graph / Facebook -->
  <meta property="og:type" content="article">
  <meta property="og:title" content="Complete Guide to HTML Meta Tags">
  <meta property="og:description" content="Learn everything about HTML meta tags including SEO, Open Graph, and Twitter Cards.">
  <meta property="og:image" content="https://example.com/images/meta-tags-guide.jpg">
  <meta property="og:image:width" content="1200">
  <meta property="og:image:height" content="630">
  <meta property="og:url" content="https://example.com/html-meta-tags">
  <meta property="og:site_name" content="Web Dev Tutorial">
  
  <!-- Twitter Card -->
  <meta name="twitter:card" content="summary_large_image">
  <meta name="twitter:site" content="@webdevtutorial">
  <meta name="twitter:creator" content="@johndoe">
  <meta name="twitter:title" content="Complete Guide to HTML Meta Tags">
  <meta name="twitter:description" content="Learn everything about HTML meta tags">
  <meta name="twitter:image" content="https://example.com/images/meta-tags-guide.jpg">
  
  <!-- Mobile theme color -->
  <meta name="theme-color" content="#4285f4">
  
  <!-- Favicon -->
  <link rel="icon" href="/favicon.ico">
  
  <!-- Stylesheet -->
  <link rel="stylesheet" href="styles.css">
</head>
<body>
  <h1>Welcome to Our Website</h1>
</body>
</html>

Testing Your Meta Tags

Always test your meta tags to ensure they work correctly:

1. Facebook Sharing Debugger

Visit Facebook Sharing Debugger to see how your page appears when shared on Facebook.

2. Twitter Card Validator

Use Twitter Card Validator to preview your Twitter card.

3. Browser DevTools

JAVASCRIPT
// Check meta tags in console (F12)
document.querySelectorAll('meta').forEach(meta => {
  console.log(meta.getAttribute('name') || meta.getAttribute('property'), 
              meta.getAttribute('content'));
});

4. View Page Source

  • Right-click on any page and select "View Page Source"
  • Look for meta tags in the <head> section
  • Verify all tags are present and correctly formatted

Common Meta Tag Mistakes

Mistake 1: Charset Not First

MARKUP
<!-- WRONG: Other tags before charset -->
<head>
  <title>My Page</title>
  <meta charset="UTF-8">
</head>

<!-- CORRECT: Charset is first -->
<head>
  <meta charset="UTF-8">
  <title>My Page</title>
</head>

Mistake 2: Duplicate Meta Tags

MARKUP
<!-- WRONG: Multiple descriptions -->
<head>
  <meta name="description" content="First description">
  <meta name="description" content="Second description">
</head>

<!-- CORRECT: Only one of each -->
<head>
  <meta name="description" content="The one description">
</head>

Mistake 3: Description Too Long

MARKUP
<!-- WRONG: Way too long (gets cut off) -->
<meta name="description" content="This is an extremely long description that goes on and on and on and provides way too much information that nobody will read because search engines will cut it off anyway and it just looks bad in search results.">

<!-- CORRECT: Concise and compelling (150-160 chars) -->
<meta name="description" content="Learn HTML meta tags in this comprehensive guide. Perfect for beginners. Includes SEO, Open Graph, and Twitter Cards.">

Mistake 4: Missing Open Graph Image

MARKUP
<!-- WRONG: No image (ugly social shares) -->
<meta property="og:title" content="My Article">
<meta property="og:description" content="Great article">

<!-- CORRECT: Always include an image -->
<meta property="og:title" content="My Article">
<meta property="og:description" content="Great article">
<meta property="og:image" content="https://example.com/article-image.jpg">

Mistake 5: Relative URLs in Social Tags

MARKUP
<!-- WRONG: Relative URLs don't work for social sharing -->
<meta property="og:image" content="/images/photo.jpg">

<!-- CORRECT: Always use absolute URLs -->
<meta property="og:image" content="https://example.com/images/photo.jpg">

Meta Tag Checklist

βœ… Essential for Every Page:

  • β˜‘ <meta charset="UTF-8">
  • β˜‘ <meta name="viewport" content="width=device-width, initial-scale=1.0">
  • β˜‘ <title> (50-60 characters)
  • β˜‘ <meta name="description"> (150-160 characters)

βœ… For Better SEO:

  • β˜‘ <meta name="robots">
  • β˜‘ <link rel="canonical">
  • β˜‘ Unique title and description per page

βœ… For Social Sharing:

  • β˜‘ Open Graph title, description, image, URL
  • β˜‘ Twitter Card type and image
  • β˜‘ Images are 1200Γ—630 pixels
  • β˜‘ Use absolute URLs for all images

Key Takeaways

  • Meta tags provide metadata about your HTML document
  • Charset should always be first in the head section
  • Viewport meta tag is essential for mobile responsiveness
  • Meta description affects SEO and click-through rates
  • Open Graph tags control social media sharing appearance
  • Twitter Cards have their own meta tags
  • Use absolute URLs for images in social meta tags
  • Keep descriptions under 160 characters
  • Each page should have unique meta tags
  • Test your meta tags with validation tools

What's Next?

Now that you understand meta tags and the head section, we'll move on to the body element. The body is where all your visible content livesβ€” everything users see and interact with on your page. You'll learn how to structure body content and understand its role in the HTML document hierarchy.

Know someone who'd find this guide helpful? Please share!

Previous
The Head Section
Next
The Body Element

Never Miss a New HTML Tutorial

Join 1,000+ developers learning HTML step-by-step. Get new tutorials, tips, and exclusive resources delivered to your inbox - completely FREE.

You might also like

UI Components

Ready-made components for your projects

Developer Tools

Boost productivity with handy generators

HTML Game

Learn HTML concepts through interactive gameplay

Join Our Web Development Training Program

Master frontend & backend development with hands-on projects.

Menu

Topics

Getting Started

  • What is HTML?
  • How the Web Works
  • Setting Up Your Environment
  • Your First HTML Page

HTML Document Structure

  • The DOCTYPE Declaration
  • The HTML Element
  • The Head Section
  • Meta Tags
  • The Body Element
  • HTML Comments

Text and Formatting

  • Headings (h1-h6)
  • Paragraphs
  • Line Breaks and Horizontal Rules
  • Text Formatting (Bold, Italic, etc.)
  • Quotations and Citations
  • Preformatted Text and Code
  • Subscript and Superscript

Links and Navigation

  • Creating Links
  • Absolute vs Relative URLs
  • Link Targets and Attributes
  • Email and Phone Links
  • Internal Page Links

Images and Media

  • Adding Images
  • Image Attributes
  • Image Formats
  • Figure and Figcaption
  • Responsive Images
  • Audio Elements
  • Video Elements
  • Embedding Content

Lists

  • Unordered Lists
  • Ordered Lists
  • Description Lists
  • Nested Lists

Tables

  • Table Basics
  • Table Headers and Footers
  • Spanning Columns and Rows
  • Table Captions
  • Styling Tables

Forms - Part 1 (Basics)

  • Introduction to Forms
  • Text Input Fields
  • Labels and Placeholders
  • Textarea Element
  • Checkboxes
  • Radio Buttons

Forms - Part 2 (Advanced)

  • Select Dropdowns
  • File Upload Inputs
  • HTML5 Input Types
  • Form Validation
  • Form Buttons
  • Fieldsets and Legends
  • Form Accessibility

Semantic HTML

  • What is Semantic HTML?
  • Header and Footer
  • Nav Element
  • Main and Article
  • Section and Aside
  • Div vs Semantic Elements
  • Time and Mark Elements

HTML5 Features

  • HTML5 Overview
  • Canvas Element
  • SVG in HTML
  • Geolocation API
  • Drag and Drop
  • Local Storage
  • Web Workers

Web Accessibility

  • Introduction to Accessibility
  • ARIA Attributes
  • Keyboard Navigation
  • Alt Text Best Practices
  • Color Contrast and Typography
  • Testing for Accessibility

Best Practices & SEO

  • HTML Best Practices
  • SEO Fundamentals
  • Meta Tags for SEO
  • Structured Data
Falytom logoFALYTOM

Learn technologies like HTML, CSS, JavaScript, React, NodeJS and more through interactive games, tutorials, components and free tools. Transform your businesses with AI chatbots, SEO-optimized websites, and professional development services.

Β© 2025 Tomilola Group
  • Facebook logo
  • Twitter logo
  • Instagram logo
  • LinkedIn logo
  • GitHub logo
  • YouTube logo