Definition
The <meta>
HTML element is used to provide metadata or additional information about an HTML document. It includes various attributes that help define characteristics of the document, such as the character encoding, viewport settings, authorship, keywords, and more.
Here’s an example of how to use the <meta>
element:
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="author" content="John Doe" />
<meta name="description" content="This is a description of the web page." />
<meta name="keywords" content="HTML, CSS, JavaScript" />
<!-- Additional meta tags -->
</head>
In this example, several <meta>
elements are included within the <head>
section of the HTML document:
- The first
<meta>
element specifies the character encoding of the document using thecharset
attribute. UTF-8 is a widely used character encoding that supports a wide range of characters. - The second
<meta>
element sets the viewport settings for responsive web design using theviewport
attribute. It ensures that the web page is displayed properly on various devices with different screen sizes. - The third
<meta>
element specifies the author of the document using theauthor
attribute. - The fourth
<meta>
element provides a brief description of the web page using thedescription
attribute. This description is often used by search engines or social media platforms when displaying search results or previews. - The fifth
<meta>
element lists relevant keywords associated with the web page using thekeywords
attribute. These keywords help search engines understand the content of the page and can influence search result rankings.
Additional <meta>
elements can be included for other purposes, such as specifying the language of the document, disabling caching, setting a favicon, or indicating the expiration date of the document.
It’s important to note that some <meta>
tags may have specific requirements or conventions depending on their purpose or usage. It’s recommended to refer to the documentation or guidelines related to the specific <meta>
tag you are using.