HTML Meta Tags

Meta Tags: The Silent Signals Behind Every Smart Web Page

Meta tags don’t show up on your webpage, but they speak volumes to search engines, browsers, and social platforms. They're your site’s introduction, translator, and rulebook — all hidden in the <head>.

1. What Are Meta Tags?

Meta tags provide metadata — information about your page — to search engines and browsers. They help define character encoding, page descriptions, viewport behavior, and more.

2. The meta charset Tag

This tag defines the character encoding — the set of characters your page supports. Without it, browsers may misinterpret text like “café” or “naïve”.

<meta charset="UTF-8">
[ Tells the browser: This page uses UTF-8, which supports nearly all characters. ]

Best Practice: Always place this at the very top of your <head> for fast interpretation.

3. The meta name="description" Tag

This tag tells search engines what your page is about. It often shows up in search result snippets.

<meta name="description" content="Learn fun facts about apples, bananas, and cherries — and which fruit wins the crown.">
[ Appears as the description beneath the link in Google Search. ]

Tips:

  • Keep it under 160 characters
  • Write like a teaser — informative but intriguing
  • Include important keywords naturally

4. The meta name="viewport" Tag

This tag controls how your webpage scales on different screen sizes — especially crucial for mobile devices.

<meta name="viewport" content="width=device-width, initial-scale=1">
[ Ensures your layout adapts to the width of the user’s device. ]

Without this tag, mobile visitors might see your page zoomed out and unreadable.

5. Other Common Meta Tags

| Tag | Purpose | |-----|---------| | <meta name="author"> | Sets the content author | | <meta name="robots"> | Tells search bots how to crawl/index | | <meta property="og:title"> | Open Graph title for social media sharing | | <meta http-equiv="refresh"> | Automatically refreshes or redirects a page |
<meta name="author" content="Fruit Team">
<meta name="robots" content="index, follow">

6. A Sample <head> with Meta Tags

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Fruit Catalog: Apple, Banana, Cherry</title>
  <meta name="description" content="Explore sweet and healthy fruit facts: apples, bananas, cherries, and more!">
</head>
[ Search engines and browsers use this metadata to index and display your page ]

Summary

Meta tags shape how your webpage is understood — by bots, browsers, and beyond. Today you learned:

  • How to define character encoding with meta charset
  • Why meta name="description" affects SEO visibility
  • How meta viewport ensures mobile responsiveness
  • Which other meta tags can support SEO, sharing, and control

Check your understanding 1

What does the <meta charset="UTF-8"> tag specify in an HTML document?
Choose one answer. You can try again.

Answer and explanation

The character encoding for the document

The <meta charset="UTF-8"> tag defines the character encoding, ensuring proper display of characters across different browsers and languages.

Check your understanding 2

The meta description tag affects how a page appears in search engine results.
Choose one answer. You can try again.

Answer and explanation

True

The meta description provides a summary shown on search engine results pages, influencing click-through rates.

Check your understanding 3

Choose the option that lists all and only the correct statements.

  1. name="description"
  2. name="viewport"
  3. http-equiv="refresh"
  4. charset="UTF-8"
Which of the following attributes are commonly used in meta tags for SEO and responsiveness?
Choose one answer. You can try again.

Answer and explanation

Statements 1 and 2 and 4

The description, viewport, and charset meta tags are essential for SEO, responsive design, and character encoding, respectively.

Check your understanding 4

What is the purpose of the meta viewport tag like <meta name="viewport" content="width=device-width, initial-scale=1.0">?
Choose one answer. You can try again.

Answer and explanation

To control layout on mobile devices for responsive design

The viewport meta tag helps browsers render pages correctly on devices of different sizes, supporting responsive design.

Check your understanding 5

Using multiple meta description tags on the same page improves SEO rankings.
Choose one answer. You can try again.

Answer and explanation

False

Only one meta description tag per page is recommended; multiple tags can confuse search engines and negatively impact SEO.

Check your understanding 6

Choose the option that lists all and only the correct statements.

  1. description
  2. keywords
  3. charset
  4. viewport
Which of these are valid values for the meta name attribute?
Choose one answer. You can try again.

Answer and explanation

Statements 1 and 2 and 4

The name attribute accepts 'description', 'keywords', and 'viewport'. 'charset' is not used with name but as a separate attribute.

What’s Next?

In the next tutorial, we’ll dive into building a complete <head> section for a real-world HTML page — with SEO, accessibility, and social sharing in mind.

Reaching the recap and completing the quizzes are separate milestones.

    Next lesson: HTML Headings Best Practices →