HTML meta tags provide important information about a web page to browsers,
search engines, social media platforms, and mobile devices. In this lesson,
you will learn common meta tags, SEO meta tags, viewport settings, responsive
web design basics, and best practices.
What Are HTML Meta Tags?
HTML meta tags are placed inside the <head> section of an HTML document.
They describe page metadata such as character encoding, page description, viewport behavior,
robots instructions, author information, and social sharing details.
<head>
<meta charset="UTF-8" />
<meta name="description" content="Learn HTML meta tags with examples." />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
HTML Meta Tags Cheatsheet
The following table shows the most commonly used HTML meta tags for SEO,
responsive design, browser behavior, and social media sharing.
Meta tags are written inside the <head> element. A clean head section
helps browsers, crawlers, and social platforms understand the page.
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>HTML Meta Tags Tutorial</title>
<meta
name="description"
content="Learn HTML meta tags, viewport, SEO tags, and responsive web design."
/>
</head>
Charset Meta Tag
The charset meta tag defines the character encoding used by the page.
UTF-8 is the recommended value because it supports most languages,
symbols, and special characters.
<meta charset="UTF-8" />
Viewport Meta Tag in HTML
The viewport meta tag controls how a web page is scaled and displayed on mobile
devices. Without this tag, mobile browsers may render the page like a desktop page,
causing text and layouts to appear too small.
width=device-width: sets the layout width to match the device width.
initial-scale=1.0: sets the initial zoom level to normal size.
This tag is essential for mobile-friendly and responsive web design.
Viewport and Responsive Web Design
Responsive web design means building pages that work well on phones, tablets,
laptops, and large desktop screens. The viewport meta tag is the first step
to making a page responsive.
After adding the viewport tag, use CSS media queries, flexible layouts, responsive
images, and relative units to make the design adapt to different screen sizes.
The meta description summarizes the page content. Search engines may use it as
the snippet in search results, so it should be clear, helpful, and keyword-friendly.
<meta
name="description"
content="Learn HTML meta tags with examples, SEO tips, viewport settings, and responsive design."
/>
Keep it clear and relevant to the page topic.
Include the main keyword naturally.
Avoid duplicate descriptions across pages.
Write for users first, not only search engines.
Robots Meta Tag
The robots meta tag gives indexing and crawling instructions to search engines.
noindex: asks search engines not to index the page.
follow: allows crawlers to follow page links.
nofollow: asks crawlers not to follow page links.
Open Graph Meta Tags
Open Graph tags control how your page appears when shared on platforms like Facebook,
LinkedIn, and other social networks.
<meta property="og:title" content="HTML Meta Tags Tutorial" />
<meta property="og:description" content="Learn meta tags for SEO and responsive design." />
<meta property="og:image" content="/images/html-meta-tags.png" />
<meta property="og:url" content="https://www.phpkingdom.com/tutorials/html/meta/" />
<meta property="og:type" content="article" />
Twitter Card Meta Tags
Twitter Card tags control how your content appears when shared on X/Twitter.
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="HTML Meta Tags Tutorial" />
<meta name="twitter:description" content="Learn HTML meta tags with examples." />
<meta name="twitter:image" content="/images/html-meta-tags.png" />
Meta Keywords Tag
The meta keywords tag was used in older SEO practices, but modern search engines
generally do not rely on it for ranking. It is better to focus on high-quality content,
clear headings, internal links, and useful page structure.
<meta name="keywords" content="HTML meta tags, SEO meta tags, viewport" />
Complete HTML Meta Tags Example
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>HTML Meta Tags Tutorial for Beginners</title>
<meta
name="description"
content="Learn HTML meta tags, SEO tags, viewport, Open Graph, Twitter cards, and responsive design."
/>
<meta name="robots" content="index, follow" />
<meta name="author" content="PHPKINGDOM" />
<meta name="theme-color" content="#0d6efd" />
<meta property="og:title" content="HTML Meta Tags Tutorial" />
<meta property="og:description" content="Learn meta tags with examples." />
<meta property="og:image" content="/images/html-meta-tags.png" />
<meta property="og:type" content="article" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="HTML Meta Tags Tutorial" />
<meta name="twitter:description" content="Learn HTML meta tags for SEO." />
</head>
HTML Meta Tags SEO Best Practices
Write a unique title and meta description for every page.
Place important meta tags inside the <head> section.
Use the viewport meta tag for mobile-friendly pages.
Use Open Graph and Twitter Card tags for better social sharing previews.
Avoid keyword stuffing in meta descriptions.
Use robots meta tags carefully to avoid blocking important pages.
Keep descriptions useful, readable, and relevant to the page content.
Common HTML Meta Tag Mistakes
Missing the viewport meta tag on responsive pages.
Using duplicate meta descriptions across many pages.
Writing very long or vague descriptions.
Using noindex accidentally on important pages.
Forgetting Open Graph image tags for social sharing.
Adding meta tags outside the <head> section.
Relying on meta keywords instead of quality content.
Key Takeaways
HTML meta tags provide information about a page.
Meta tags are placed inside the <head> element.
The viewport meta tag is required for mobile-friendly responsive design.
Meta descriptions help improve search result snippets.
Open Graph and Twitter Card tags improve social media previews.
Use robots meta tags carefully to control indexing and crawling.
Pro Tip
Every modern HTML page should include at least
<meta charset="UTF-8" />,
<meta name="viewport" content="width=device-width, initial-scale=1.0" />,
a unique title, and a useful meta description.
You now understand HTML meta tags, viewport settings, SEO metadata, social sharing tags,
and responsive web design basics. Next, continue with the next HTML topic in your learning path.