MyInternships.in

HTML Tags

HTML <meta> Tag

The <meta> tag provides metadata about an HTML document, such as its character encoding, viewport settings, and description for search engines. It is a void element placed in the <head>.


The <meta> Tag

The <meta> element represents metadata that cannot be expressed by other head elements like <title> or <link>. Common uses include declaring the character set, controlling the mobile viewport, and providing a description and keywords for search engines and social platforms.

It is a void element (no closing tag) and always lives in the <head>. A document can have many <meta> elements, each describing one piece of metadata.

Syntax

Two common meta declarations.
Example
<meta charset="UTF-8" />
<meta name="description" content="A short page summary" />

Example

Charset, viewport, and description meta tags together.
Example
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="Learn HTML with runnable examples." />
    <title>Meta Tag Demo</title>
  </head>
  <body>
    <h1>Open the tab title and view source to see the meta tags.</h1>
  </body>
</html>

More Examples

Author, robots, and Open Graph meta tags.
Example
<!DOCTYPE html>
<html>
  <head>
    <meta name="author" content="Jane Developer" />
    <meta name="robots" content="index, follow" />
    <meta property="og:title" content="My Great Article" />
    <title>Social and SEO Meta</title>
  </head>
  <body>
    <h1>These meta tags control SEO and social previews.</h1>
  </body>
</html>

Attributes

AttributeDescription
charsetDeclares the character encoding, almost always UTF-8.
nameThe metadata name, for example description, keywords, viewport, author, robots.
contentThe value associated with the name or http-equiv.
http-equivProvides an HTTP header-like directive, such as content-type or refresh.
propertyUsed by Open Graph and similar protocols, for example og:title.
💡

Always include <meta charset="UTF-8"> and the viewport meta tag. The viewport tag is essential for responsive design on mobile devices.

Key Takeaways

  • <meta> defines document metadata inside <head>.
  • It is a void element with no closing tag.
  • charset sets the encoding; use UTF-8.
  • The viewport meta tag is required for responsive mobile pages.
  • name/content pairs power SEO and social previews.

Related HTML Topics

Keep learning with these closely related tutorials.

Ready to use your HTML skills?

Find web development internships and fresher jobs across India.

Browse Web Dev Internships