In HTML <head> element is the container for all the other HTML element that contain other element such as. 


<head> container contains:

<title>
<meta>
<style>
<link>
<base>
<script>


The <title> Element

The <title> element specifies the title of the document.


Syntax:

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



<meta> Element

Define the character set used:

<meta charset="UTF-8">


Define a description of your web page:

 <meta name="description" content="Rathorji Tutorial">


Define keywords for search engines:

<meta name="keywords" content="HTML, CSS, PHP">


Define the author of a page:

<meta name="author" content="John Doe">


Refresh document every 50 seconds:

<meta http-equiv="refresh" content="50">



<style> Element

The <style> tag is used to specify style for a perticular HTML page:


Example:

<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Page Titile</title>
        <style>
            p{
                Color: red;
            }
        </style>
    </head>
    <body>
        <p>Hello World!</p>
    </body>
</html>



<link> Element

The <link> element is used to load the CSS file


example:

<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Page Titile</title>
        <!-- style.css is external file to load-->
        <link rel="stylesheet" href="style.css">
    </head>
    <body>
        <p>Hello World!</p>
    </body>
</html>



<script> Element

The <script> element is used to specify a client-side script, such as JavaScript in HTML documents.


example:

<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Page Title</title>
    </head>
    <body>
        <script>
            document.write("Hello World!")
        </script>
    </body>
</html>  





Are you facing problems in understanding this article?
You can watch the video. Watch it now