Cover Image for HTML head Tag
55 views

HTML head Tag

The <head> tag is an HTML element that is used to define the head section of an HTML document. It contains meta-information and other non-visible elements that provide instructions and settings for the browser and search engines. The <head> element is typically placed between the opening <html> tag and the opening <body> tag.

Here’s an example of how the <head> tag is used:

HTML<span role="button" tabindex="0" data-code="<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>My Web Page</title> <link rel="stylesheet" href="styles.css"> <script src="script.js"></script> </head> <body> <!– Content of the web page goes here –> </body>
<!DOCTYPE html>
<html>
     <head>
          <meta charset="UTF-8">
          <title>My Web Page</title>
          <link rel="stylesheet" href="styles.css">
          <script src="script.js"></script>
     </head>
     <body>
           <!-- Content of the web page goes here -->
     </body>
</html>

In this example, the <head> section contains several elements:

  • <meta charset="UTF-8">: Specifies the character encoding for the document. It ensures that the browser interprets the text correctly.
  • <title>: Defines the title of the HTML document, which appears in the browser’s title bar or tab.
  • <link rel="stylesheet" href="styles.css">: Links an external CSS file (styles.css) to apply styles and formatting to the HTML content.
  • <script src="script.js"></script>: Links an external JavaScript file (script.js) that contains client-side scripts to enhance the functionality of the web page.

These are just a few examples of elements that can be included within the <head> section. Other elements like <meta> tags for SEO (search engine optimization), Open Graph tags for social media sharing, and more can also be added as needed.

It’s important to note that the content within the <head> tag does not directly appear on the web page itself. Instead, it provides instructions and metadata to the browser and search engines to enhance the document’s presentation and functionality.

YOU MAY ALSO LIKE...

The Tech Thunder

The Tech Thunder

The Tech Thunder


COMMENTS