The HTML <head> Element
The <head> element is a container for metadata (data about data) and is placed between the <html> tag and the <body> tag.
HTML metadata is data about the HTML document. Metadata is not displayed. Metadata typically define the document title, character set, styles, scripts, and other meta information.
Common Tags in <head>
The following elements can go inside the <head> element:
- The
<title>element defines the title of the document, which is required in all HTML documents. - The
<style>element is used to define style information for a single HTML page. - The
<link>tag is most often used to link to external style sheets. - The
<meta>element is used to specify character set, page description, keywords, author of the document, and viewport settings. - The
<script>tag is used to define client-side JavaScripts. - The
<base>element specifies the base URL/target for all relative URLs in a page.
html
<!DOCTYPE html>
<html>
<head>
<title>My Page Title</title>
<meta charset="UTF-8">
<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>
<body>
The content of the document......
</body>
</html>Test Yourself with an Exercise
Which element is NOT typically found inside the <head> section?