HTML <meta> Tag
Definition and Usage
The <meta> tag defines metadata about an HTML document. Metadata is data (information) about data.
<meta> tags always go inside the <head> element, and are typically used to specify character set, page description, keywords, author of the document, and viewport settings.
Metadata will not be displayed on the page, but is machine parsable.
Metadata is used by browsers (how to display content or reload page), search engines (keywords), and other web services.
There is 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).
Example
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="description" content="Free Web tutorials"> <meta name="keywords" content="HTML,CSS,XML,JavaScript"> <meta name="author" content="John Doe"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <p>All meta information goes in the head section...</p> </body> </html> |
All meta information goes in the head section…
More Examples
Define keywords for search engines:
|
1 |
<meta name="keywords" content="HTML, CSS, JavaScript"> |
Define a description of your web page:
1
<meta name="description" content="Free Web tutorials for HTML and CSS">
Define the author of a page:
1
<meta name="author" content="John Doe">
Refresh document every 30 seconds:
1
<meta http-equiv="refresh" content="30">
Setting the viewport to make your website look good on all devices:
1
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Define a title of your web page:
1
<meta name="title" content="This is our website ( CodenBytes ) ">