HTML <meta> Attributes

HTML <meta> charset Attribute

Example

Specify the character encoding for the HTML document:

<head>
<meta charset=”UTF-8″>
</head>

Try it Yourself »


Definition and Usage

The charset attribute specifies the character encoding for the HTML document.

Tip: The charset attribute can be locally overridden using the lang attribute on any element.

HTML <meta> content Attribute

Example

Describe metadata within an HTML document:

<head>
<meta name=”description” content=”Free Web tutorials”>
<meta name=”keywords” content=”HTML,CSS,XML,JavaScript”>
</head>

Try it Yourself »


Definition and Usage

The content attribute gives the value associated with the http-equiv or name attribute.

HTML <meta> http-equiv Attribute

Example

Refresh document every 30 seconds:

<head>
<meta http-equiv=”refresh” content=”30″>
</head>

Try it Yourself »


Definition and Usage

The http-equiv attribute provides an HTTP header for the information/value of the content attribute.

The http-equiv attribute can be used to simulate an HTTP response header.

HTML <meta> name Attribute

Example

Use the name attribute to define a description, keywords, and the author of an HTML document. Also define the viewport to control the page’s dimensions and scaling for different devices:

<head>
<meta name=”description” content=”Free Web tutorials”>
<meta name=”keywords” content=”HTML,CSS,JavaScript”>
<meta name=”author” content=”John Doe”>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
</head>

Try it Yourself »


The name attribute specifies the name for the metadata.

The name attribute specifies a name for the information/value of the content attribute.

Note: If the http-equiv attribute is set, the name attribute should not be set.

HTML5 introduced a method to let web designers take control over the viewport (the user’s visible area of a web page), through the <meta> tag (See “Setting The Viewport” example below).

HTML <meta> scheme Attribute

Example

Use the scheme attribute to define formats for the content attribute:

<head>
<meta name=”date” content=”2009-01-02″ scheme=”YYYY-MM-DD”>
<meta name=”identifier” content=”0-2345-6634-6″ scheme=”ISBN”>
</head>

Try it Yourself »


Definition and Usage

The <meta> scheme attribute is not supported in HTML5.

The scheme attribute specifies a scheme (format or URI) to be used to interpret the value of the content attribute.