Lably
Skip to content

Meta element

HTML Metadata

  • 10 min read
  • 5 chapters

Related on Lably

Through Web page, HTML and HTTP

The meta element has two uses: either to emulate the use of an HTTP response header field, or to embed additional metadata within the HTML document.

With HTML up to and including HTML 4.01 and XHTML, there were four valid attributes: content, http-equiv, name and scheme. Under HTML 5, charset has been added and scheme has been removed. http-equiv is used to emulate an HTTP header, and name to embed metadata. The value of the statement, in either case, is contained in the content attribute, which is the only required attribute unless charset is given. charset is used to indicate the character set of the document, and is available in HTML5.

Such elements must be placed as tags in the head section of an HTML or XHTML document.

Examples of the meta element

meta elements can specify HTTP headers which should be sent before the actual content when the HTML page is served from the web server to the client. For example:

<span id="mwMA"></span><span class="p" id="mwMQ"><</span><span class="nt" id="mwMg">meta</span> <span class="na" id="mwMw">charset</span><span class="o" id="mwNA">=</span><span class="s" id="mwNQ">"utf-8"</span><span class="p" id="mwNg">></span>

as an alternative to the response header Content-Type: to indicate the media type and, more commonly needed, the UTF-8 character encoding.

Meta tags can be used to describe the contents of the page:

<span id="mwQw"></span><span class="p" id="mwRA"><</span><span class="nt" id="mwRQ">meta</span> <span class="na" id="mwRg">name</span><span class="o" id="mwRw">=</span><span class="s" id="mwSA">"description"</span> <span class="na" id="mwSQ">content</span><span class="o" id="mwSg">=</span><span class="s" id="mwSw">"The Federal Aviation Administration is an operating mode of the U.S. Department of Transportation."</span><span class="p" id="mwTA">></span>

In this example, the meta element describes the contents of a web page.

Sign in to keep reading

4 more chapters are free with a Lably account.

More in Computing and communication