<head> Tag in HTML

The <head> tag in HTML is used to contain metadata and links to external files that are required for the document, such as stylesheets, scripts, and fonts. The <head> section does not display content directly on the webpage but provides essential information about the document to the browser and search engines.

Key Points on <head> Tag:

Syntax of <head> Tag:

Syntax Example

<head>
            <meta charset="UTF-8">
            <title>Page Title</title>
            <link rel="stylesheet" href="styles.css">
            <script src="script.js"></script>
        </head>

Example of <head> Tag in HTML:

This example demonstrates the use of the <head> tag to include a title, a stylesheet, and a script.

Code Example


        <html>
            <head>
                <meta charset="UTF-8">
                <title>My Web Page</title>
                <link rel="stylesheet" href="style.css">
                <script src="app.js"></script>
            </head>
            <body>
                
            </body>
        </html>
                

Output

The title, styles, and scripts specified in the <head> section would affect the page, but are not displayed directly here.

The <head> tag is essential for providing meta-information about the document. The <title> tag inside the <head> tag sets the title of the page, which appears in the browser's title bar or tab. The <meta> tag provides metadata about the document, such as the character set. External resources like stylesheets and scripts are also linked within the <head> section.