Document Metadata
HTML <meta> element
Supplies metadata not represented by other head elements. Use charset for encoding, name with content for named metadata, or http-equiv for supported pragmas. The charset form declares encoding; the name/content form supplies named metadata; http-equiv selects a supported pragma. Do not combine these modes arbitrarily. A meta CSP cannot replace all response header policies. It accepts global HTML attributes; individual global features may be inapplicable or restricted.
Formal Syntax & Structure
html syntaxhtml
<meta charset="utf-8">Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| name | string | Provides an element-specific name: a form field key, radio group name, named frame, metadata key, slot name or other defined purpose. Its meaning depends on the element; it is not a unique DOM identifier. |
| http-equiv | pragma keyword | Selects a limited set of browser processing directives in meta. It is not an arbitrary HTTP response header mechanism; some policies require actual response headers. |
| content | text | Value of the name or http-equiv directive; not used with charset. |
| charset | UTF-8 | Declares the encoding in a meta element. Place the declaration early in the document head, within the first 1024 bytes, and encode the file as UTF-8. |
| media | media query list | Specifies conditions under which a resource or metadata applies, such as a stylesheet's target media or a picture source's viewport condition. |
Return Value
HTMLMetaElement
Content model: Empty; this void element cannot contain children and must not have an end tag. No closing tag.
Working Example
Example Snippethtml
<!doctype html><html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Guide</title> </head> <body> <p>Guide</p> </body></html>