HTML Head Element
HTML element <head>
allows the below key elements that carry information about an HTML document.
<title>
to set the document title<base>
to define the base URL or target for all the relative paths on a page<meta>
to define document metadata like character set, author, description, keywords, viewpoint, refresh, etc.,<link>
to link external resources like favicon and external stylesheets<style>
to define page styles<script>
to define or link javascript
For more details about these elements, do read the respective article.
Example
<!doctype html>
<html lang="en">
<head>
<title>Random Codez</title>
<base href="/">
<meta charset="UTF-8">
<meta name="author" content="Arun Kumar Choppara">
<meta name="description" content="Random Codez HTML Tutorial">
<link rel="icon" href="/assets/images/favicon.ico">
<link rel="stylesheet" href="mystyles.css">
<script src="myscripts.js"></script>
<style>
body {background-color: orange;}
</style>
<script>
function myFunction() {
document.getElementById("sample").innerHTML = "Hello World!! from Javascript.";
}
</script>
</head>
<body>
<h1>HTML Head</h1>
<h2>Check the page source code to see the elements included in head tag.</h2>
<p id="sample"></p>
</body>
</html>
Overall
We now have a clear understanding of <head>
element along with the elements that it includes.