Encodera

Thanks for reading!

Donate to the site — we work hard for you.

HTML & CSS reference

<meta>

Page metadata: encoding, phone settings, a description for search engines.

Syntax

<meta name="description" content="text">

Attributes

ParameterTypeDescription
charsetutf-8The encoding of the page.
namedescription | viewport | robots | …Which property of the page the tag describes.
contenttextThe value of that property.
propertyog:title | og:image | …Open Graph properties for previews in social networks and messengers.

Examples

The most needed <meta> tags:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="Fresh coffee and cakes in the city centre.">
    <title>The Bean</title>
  </head>
  <body>
    <p>Meta tags are invisible but read by browsers and search engines.</p>
  </body>
</html>

A link preview for social networks (Open Graph):

<meta property="og:title" content="The Bean coffee shop">
<meta property="og:image" content="https://example.com/cover.jpg">
<p>These tags change how a shared link looks.</p>

Notes

Put charset first in <head>, otherwise the browser may misread the letters. Without viewport a phone shows a shrunken copy of the desktop version, and media queries do not work. The tag is single — it has no closing part.

See also

  • <head> — The service part of the page: encoding, tab title, linked styles and scripts.
  • <title> — The page title: the text on the browser tab and in search results.
  • <link> — Links an external resource to the page: a stylesheet, the site icon, a font.

Related recipes

In the tutorial

  • Meta tags and SEO — What goes into head — title, meta description, viewport, Open Graph for social networks, the site icon, canonical and robots.

Thanks for reading!

Donate to the site — we work hard for you.