HTML HTML Tutorial HTML Forms HTML Graphics HTML Media HTML APIs HTML Tags



HTML Tag: head

The <head> tag is an important part of an HTML document. It is used to define the head section of the document, which contains information about the document that is not displayed on the web page. This information includes the title of the document, links to external stylesheets and scripts, and meta data that describes the content of the page. The <head> tag is typically placed at the beginning of an HTML document, before the <body> tag. It is not visible on the web page, but it is used by web browsers and search engines to understand the content of the page. The <head> tag can contain several other tags, including:

The <title> Tag

The <title> tag is used to define the title of the document. This title is displayed in the title bar of the web browser and is also used by search engines to understand the content of the page. Example: <head>
    <title>My Website</title>
</head>

The <meta> Tag

The <meta> tag is used to provide meta data about the document. This meta data includes information such as the author of the document, keywords that describe the content of the page, and a description of the page. Example: <head>
    <meta name="description" content="This is my website.">
    <meta name="keywords" content="HTML, CSS, JavaScript">
    <meta name="author" content="John Doe">
</head>

The <link> Tag

The <link> tag is used to link to external resources, such as stylesheets and scripts. This allows you to separate the presentation and behavior of the page from the content of the page. Example: <head>
    <link rel="stylesheet" href="style.css">
    <link rel="script" href="script.js">
</head>

Example 1: Title Tag

<head>
    <title>My Website</title>
</head>

Example 2: Meta Tag

<head>
    <meta name="description" content="This is my website.">
    <meta name="keywords" content="HTML, CSS, JavaScript">
    <meta name="author" content="John Doe">
</head>

Example 3: Link Tag

<head>
    <link rel="stylesheet" href="style.css">
    <link rel="script" href="script.js">
</head>

Activity