Welcome to HTML5-Tutorials

Our site offers a lot of HTML5 learning from absolutely beginning to advanced level.If you want to make a website with HTML,this site will completely guide you a lot.So learn HTML5 syntax and form of coding easily with this website.If you have any doubt,leave a message on us.We will return you so soon.This site includes innumerable number of references you need to do after studying their corresponding elements.

In this page,we will learn about HTML <head> tag.

Overview Content

1 Use of <head> tag
2 Example of <head> tag
3 Supported Browsers
4 Full Code Example
5 Contents of <head> element
        5.1 <title> tag
        5.2 <style> tag
        5.3 <meta> tag
        5.4 <link> tag
        5.5 <script> tag
        5.6 <base> tag
        5.7 <noscript> tag

Use of <head> tag

The HTML <head> tag is a tag that provides information about that page(metadata).This element is contained between <html> and <body> Some tags which is used in the <head> section are <title>, <style> etc

Display:Block

Example of <head> tag

    <title> My first page </title>

Supported Browsers.

Tag
<head> Yes Yes Yes Yes Yes

Full Code Example

<!DOCTYPE html>
<html>
<head>
<title> This is first page </title>
<link href="style.css" type="text/css" rel="stylesheet">
</head>
<body>
---------------------Content here--------------
</body>
</html>

1. <title> tag

  • It defines the title of the HTML document in a window.
  • It helps in displaying on search engine results.
  • Full Code Example

    <!DOCTYPE html>
    <html>
    <head>
    <title> This is first page </title>
    </head>
    <body>
    ---------------------Content here--------------
    </body>
    </html>

    2. <style> tag

  • It defines the style of an individual HTML Page.
  • All Styles are making with CSS.
  • Full Code Example

    <!DOCTYPE html>
    <html>
    <head>
    <style>
    p{
    color:red;
    text-decoration:underline;
    }
    </style>
    </head>
    <body>
    <p> I am a paragraph with red in color and underline in decoration. </p>
    </body>
    </html>

    3. <meta> tag

  • This <meta> element is used to denote which character set is used, keywords, page description & author name etc.
  • Adding this meta element helps in finding on web search results.
  • Full Code Example

    <!DOCTYPE html>
    <html>
    <head>
    <meta name="description" content="HTML5 Tutorials">
    <meta name="keywords" content="HTML5,Advanced HTML">
    <meta name="author" content="Swamikanta Longjam">
    </head>
    <body>
    ---------------------Content here--------------
    </body>
    </html>

    4. <link> tag

  • This <link> element is used to link with an external CSS.
  • It is the most common CSS linking form.
  • Full Code Example

    <!DOCTYPE html>
    <html>
    <head>
    <link href = "style.css" rel="stylesheet" type="text/css" media="all">
    <link href = "bootstrap.css" rel="stylesheet" type="text/css" media="all">
    </head>
    <body>
    ---------------------Content here--------------
    </body>
    </html>

    5. <script> tag

  • This <script> element is used to define JavaScript code.
  • JavaScript is used to show the behavior of web pages.
  • Full Code Example

    <!DOCTYPE html>
    <html>
    <head>
    <script>
    function myFunction( ) {
    alert(" I am an Alert Box!");
    }
    </script>
    </head>
    <body>
    <p> Click the Button to display an alert box </p>
    <button onclick="myFunction( )"> Click Me </button>
    </body>
    </html>

    6. <base> tag

  • The element specifies the base URL and base target in a website page.
  • It is not used generally.
  • Full Code Example

    <!DOCTYPE html>
    <html>
    <head>
    <base href="http://www.myhtml5tutorials.com/" target="_blank">
    </head>
    <body>
    <p> All the links in this document will be open in a new window or tab. </p>
    <p> Any URL in this document will search the directory http://www.myhtml5tutorials.com/ </p>
    </body>
    </html>

    7. <noscript> tag

  • It defines whether the writing script is support or not in the active browsers.
  • It can be used in both <head> and <body>.
  • Full Code Example

    <!DOCTYPE html>
    <html>
    <head>
    <script>
    document.write("Hello World!")
    </script>
    <noscript> Your browser does not support JavaScript! </noscript>
    </head>
    <body>
    ---------------------Content here--------------
    </body>
    </html>