In this tutorial, you will learn HTML head Element or tag
The head element in HTML is used to contain meta-information about the document, such as the title, keywords, and stylesheets. The head element is placed within the HTML document, but it is not displayed on the web page.
Here is an example of how to use the head element in HTML:
<!DOCTYPE html> <html> <head> <title>My Web Page</title> <meta name="keywords" content="HTML, head, tutorial"> <link rel="stylesheet" type="text/css" href="styles.css"> </head> <body> <p>This is the content of my web page.</p> </body> </html>
- The “title” element is used to specify the title of the web page, which is displayed in the browser’s title bar or tab.
- The “meta” element is used to provide meta-information about the document, such as keywords for search engines, and the “name” and “content” attributes are used to specify the name and content of the meta-information.
- The “link” element is used to link to external resources, such as stylesheets. The “rel” attribute specifies the relationship between the current document and the linked resource, “type” attribute specifies the type of the resource, and “href” attribute specifies the location of the resource.
- You can also include scripts in the head element, like this:
<script src="script.js"></script>
- You can also use the “base” element that could set the default URL and default target for all relative URLs on a page.
<base href="https://www.example.com" target="_blank">
The head element is an important part of an HTML document, as it contains important information that is not displayed on the web page but is used by web browsers and search engines to understand and display the document correctly.
In summary, the head element in HTML is used to contain meta-information about the document, such as the title, keywords, and stylesheets. It is placed within the HTML document, but it is not displayed on the web page. The head element contains important information that is used by web browsers and search engines to understand and display the document correctly, and it can also include scripts, base elements, and other elements.