HTML Head Element

All information about the HTML document is give in the html head element.
<head> element is give only once on this HTML document.
In <head> element, <style>, <script>, <link>, <meta> these element given.

The <head> element is give after the <html> tag and before the <body> tag.

HTML <title> Element

The title is give from the <title> element to the HTML document. Tagging every HTML document is very important.

Example

<!DOCTYPE html>
<html>

<head>
  <title>Page Title</title>
</head>

<body>

</body>

</html>

HTML <style> Element

Style is give for the HTML tags in the <style> element.

Example

<!DOCTYPE html>
<html>
<head>
  <title>Page Title</title>
  <style>
    body {background-color: powderblue;}
    h1 {color: red;}
    p {color: blue;}
  </style>
</head>  
<body>

<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
  
</body>
</html>

HTML <link> Element

The <link> element is use to bring an external css (cascading style sheet) on the HTML document.

Example

<!DOCTYPE html>
<html>
<head>
  <title>Page Title</title>
  <link rel="stylesheet" href="mystyle.css">
</head>
<body>

<p>This is a paragraph.</p>
  
</body>
</html>

HTML <script> Element

The javascript code is give on the HTML document in the <script> element and the external .js file is also give on the HTML document with the ‘src’ attribute.

Example

<!DOCTYPE html>
<html>
<head>
  <title>Page Title</title>
  <script>
  function myFunction() {
    document.getElementById("demo").innerHTML = "Hello JavaScript!";
  }
  </script>
</head>
<body>

<h1>My Web Page</h1>
<p id="demo">A Paragraph</p>
<button type="button" onclick="myFunction()">Try it</button>

</body>
</html>