Movatterモバイル変換


[0]ホーム

URL:


MDN Web Docs

<meta>: The metadata element

BaselineWidely available *

The<meta>HTML element representsmetadata that cannot be represented by other meta-related elements, such as<base>,<link>,<script>,<style>, or<title>.

The type of metadata provided by the<meta> element can be one of the following:

  • If thename attribute is set, the<meta> element providesdocument-level metadata that applies to the whole page.
  • If thehttp-equiv attribute is set, the<meta> element acts as apragma directive to simulate directives that could otherwise be given by an HTTP header.
  • If thecharset attribute is set, the<meta> element is acharset declaration, giving the character encoding in which the document is encoded.
  • If theitemprop attribute is set, the<meta> element providesuser-defined metadata.

Attributes

This element includes theglobal attributes.

Note:Thename attribute has a specific meaning for the<meta> element.Theitemprop attribute must not be set on a<meta> element that includes aname,http-equiv, orcharset attribute.

charset

This attribute declares the document's character encoding. If the attribute is present, its value must be an ASCII case-insensitive match for the string"utf-8", because UTF-8 is the only valid encoding for HTML5 documents.<meta> elements which declare a character encoding must be located entirely within the first 1024 bytes of the document.

content

This attribute contains the value for thehttp-equiv orname attribute, depending on which is used.

http-equiv

Defines a pragma directive, which are instructions for the browser for processing the document.The attribute's name is short forhttp-equivalent because the allowed values are names of equivalent HTTP headers.

media

Themedia attribute defines which media the theme color defined in thecontent attribute should be applied to.Its value is amedia query, which defaults toall if the attribute is missing.This attribute is only relevant when the element'sname attribute is set totheme-color.Otherwise, it has no effect, and should not be included.

name

Thename andcontent attributes can be used together to provide document metadata in terms of name-value pairs, with thename attribute giving the metadata name, and thecontent attribute giving the value.

Examples

Setting a meta description

The following<meta> tag provides adescription as metadata for the web page:

html
<meta  name="description"  content="The HTML reference describes all elements and attributes of HTML, including global attributes that apply to all elements." />

Setting a page redirect

The following example useshttp-equiv="refresh" to direct the browser to perform a redirect.Thecontent="3;url=https://www.mozilla.org" attribute will redirect page tohttps://www.mozilla.org after 3 seconds:

html
<meta http-equiv="refresh" content="3;url=https://www.mozilla.org" />

Technical summary

Content categoriesMetadata content. If theitemprop attribute is present:flow content,phrasing content.
Permitted contentNone; it is avoid element.
Tag omissionMust have a start tag and must not have an end tag.
Permitted parents
Implicit ARIA roleNo corresponding role
Permitted ARIA rolesNorole permitted
DOM interfaceHTMLMetaElement

Specifications

Specification
HTML
# the-meta-element

Browser compatibility

See also

Help improve MDN

Learn how to contribute.

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp