Definition
The <head>
HTML element is a container element that serves as the container for metadata and other non-visible elements within an HTML document. It is located at the beginning of the document before the <body>
element.
Here’s an example of how the <head>
element is typically structured:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Page Title</title>
<!-- Additional metadata, stylesheets, scripts, etc. -->
</head>
<body>
<!-- Content of the webpage goes here -->
</body>
</html>
In this example, the <head>
element wraps several elements, including the <meta>
element and the <title>
element. The <meta>
element specifies the character encoding used in the document, while the <title>
element sets the title of the webpage, which is displayed in the browser’s title bar or tab.
The <head>
element can also contain other elements like <link>
to reference external stylesheets, <script>
to include JavaScript files, <style>
to define inline styles, and <base>
to specify the base URL for relative links.
The content within the <head>
element is not directly displayed on the webpage but instead provides information and instructions to the browser and search engines.