Meta Tag in HTML

The <meta> tag gives information about the web page to the browser and to search engines. It is placed inside the <head> and has no closing tag. The information is written with attributes like name, content and charset.


Common meta tags

Character set

Tells the browser which characters to use. Always use UTF-8, which supports all languages and symbols.

<meta charset="UTF-8">

Viewport

Makes the page fit the screen width of mobile phones. Without it, a phone shows a tiny zoomed-out desktop page.

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

Description

A short summary of the page. Search engines often show it under the title in the search results. Write 120 to 155 characters.

<meta name="description" content="Learn HTML meta tags with simple examples.">

Robots

Tells search engines what to do with the page.

<meta name="robots" content="noindex, nofollow">
  • noindex means do not show this page in search results.
  • nofollow means do not follow the links of this page.

Author

<meta name="author" content="Tutorials Class">

Refresh

Reloads the page, or sends the visitor to another page, after some seconds. It works, but a server redirect is a better way.

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

Does the keywords meta tag help SEO?

Old tutorials tell you to add <meta name="keywords">. Google has ignored this tag for many years, so it does not help your ranking. You can skip it. The title and description are the ones that matter.


Summary

  • Meta tags go in the head and give information about the page.
  • Always add charset and viewport.
  • Write a unique description for each page.
  • Use robots only when you want to hide a page from search engines.

Congratulations! Chapter Finished. Learn more about the similar topics:
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.