Code has been added to clipboard!

HTML meta Tag

Reading time 2 min
Published Jun 29, 2017
Updated Oct 2, 2019

HTML meta: Main Tips

  • With meta tags, HTML metadata can be defined.
  • In Greek, meta means beyond. Thus, metadata is not displayed on the web page: it is only parsable by the machine.
  • Using the meta tag, keywords, descriptions, and other information can be specified for the page.
  • HTML meta tags must be placed inside the <head> element.
  • You can use one or multiple meta tags in one document.

Using HTML meta Tags

The content between HTML meta tags is supplementary information about a website which is not displayed in the page:

Example
<head>
<meta charset="UTF-8">
<meta name="description" content="Learn to code!">
<meta name="keywords" content="HTML, PHP, JavaScript">
<meta name="author" content="The BitDegree Team">
</head>

Metadata is useful in search engine optimization (SEO). Search engines use meta keywords to gather information about the content your website offers its users.

Note: you can also set the viewport using your meta tags to control the visible page areas. However, not every browser supports that.

Tag-specific Attributes for <meta>

charset sets the character encoding for the webpage:

Example
<meta charset="UTF-8">

Tip: defining character encoding helps prevent cross-scripting attacks. You should use UTF-8 or another ASCII-compatible encoding.

name sets a name for the metadata (e.g., meta keywords, author, etc.):

Example
<meta name="description" content="Learn to code">

http-equiv defines a pragma directive. All the possible values have the same names as certain HTTP headers (i.e., content-security-policy or refresh), hence the name:

Example
<meta http-equiv="refresh" content="30">

content defines the value for the name or http-equiv attribute:

Example
<meta name="description" content="Learn to code">
<meta name="keywords" content="HTML, HTML Meta Tag">

scheme used to set the context in which the value of the content attribute should have been interpreted (a format):

Example
<meta name="date" content="2019-08-04" scheme="YYYY-MM-DD">

Note: the scheme attribute has been made obsolete in HTML5.

Browser support

Chrome
All
Edge
All
Firefox
1+
IE
All
Opera
All
Safari
All

Mobile browser support

Chrome
All
Firefox
4+
Opera
All
Safari
All
Basics
Introduction
Syntax
Editors
Basic Examples
Head Section
<!DOCTYPE>
Tags and Elements
Semantic Elements
Tags Reference
Attributes
Comments
Block and Inline Elements
Forms
Form Elements
Input
Responsive Web Design
Inline Scripts
Uniform Resource Locator
Redirect
XHTML
Geolocation
Drag and Drop
Local Storage
Web Workers
Server-Sent Events
Character Encoding
Text Formatting
Quotation and Citation Elements
Headings
Paragraphs
Links
Tables
Lists
Symbols
Space
Tab
Styles
Computer Code
Layout
Classes
Colors
Images
iframes
Audio Player
Video Player
YouTube Videos
Multimedia
Canvas
SVG
<!-- -->
<a>
<abbr>
<acronym> DEPRECATED
<address>
<applet> DEPRECATED
<article>
<aside>
<audio>
<b>
<base>
<basefont> DEPRECATED
<bdi>
<bdo>
<big> DEPRECATED
<blink> DEPRECATED
<blockquote>
<body>
<br>
<button>
<canvas>
<caption>
<center> DEPRECATED
<cite>
<code>
<col>
<colgroup>
<datalist>
<dd>
<del>
<details>
<dfn>
<dialog>
<dir> DEPRECATED
<div>
<dl>
<dt>
<em>
<embed>
<fieldset>
<figcaption>
<figure>
<font> DEPRECATED
<footer>
<form>
<frame> DEPRECATED
<frameset> DEPRECATED
<h1> – <h6>
<head>
<header>
<hr>
<html>
<i>
<iframe>
<img>
<input>
<ins>
<kbd>
<keygen> DEPRECATED
<label>
<legend>
<li>
<link>
<main>
<map>
<mark>
<menu>
<menuitem> DEPRECATED
<meta>
<meter>
<nav>
<noframes> DEPRECATED
<noscript>
<object>
<ol>
<optgroup>
<option>
<output>
<p>
<param>
<pre>
<progress>
<q>
<rp>
<rt>
<ruby>
<s>
<samp>
<script>
<section>
<select>
<small>
<source>
<span>
<strike> DEPRECATED
<strong>
<style>
<sub>
<summary>
<sup>
<table>
<tbody>
<td>
<tfoot>
<th>
<thead>
<time>
<title>
<tr>
<track>
<tt> DEPRECATED
<u>
<ul>
<var>
<video>
<wbr>