HTML HEAD ELEMENTS

Being BENI24

HTML Head Elements

In HTML the <Head>element is used to contain metadata about the HTML document, such as title, character set, linked stylesheets, scripts and other  meta-information.

The content within the <head>element is not displayed on the actual webpage but provides essential information for searchers and web engineers.

You can customize the "<head>" section based on the specific requirements of your web page.

<title>:Defines the title of the HTML document, which appears in the browser's title or tab.
<link>: Can be used to link external resources such as stylesheets or icon files.
<style>: Contains internal CSS styles for the document.
<script>: Contains or links to JavaScript code.


Syntax:

<head>
<title> This is my webpage head</title>
</head>


HTML <head> Tag:

In the HTML <head> element is Metadata is contained. It is inserted between the <html> and <body> tags.

A portion of an HTML document called the head contains content that is not shown in the browser when the page loads. It only includes metadata, or information about the HTML document that specifies specifics.


Example:


  <!DOCTYPE html>
  <html>
  <head>
    <title>HTML document Title</title>
  </head>
  <body>
  <h1>This is heading</h1>
  <p>This is paragraph.</p>
  </body>
  </html>


Output:



HTML <style> Tag:


To declare style information (CSS) for a document, use the <style> tag. Here, the developer can specify the page's or website's appearance and layout, including the font, color, etc..

Syntax:

<tagname style="property:value;">


Example:


  <!DOCTYPE html>
  <html>
  <head>
    <title>HTML document Title</title>
    <style>
      body {background-color: lightpink;}
      h1 {color: purple;}
      p {color: blue;}
    </style>
  </head>
  <body>
  <h1>This is heading</h1>
  <p>This is paragraph.</p>
  </body>
  </html>


Output:




Html <link> Tag:

HTML<link> an external style sheet to your webpage using the HTML <link> element. "rel" and "href" are the two primary attributes of the <link> element. 

The path to that external file is provided by href, and the rel attribute indicates that it is a stylesheet.


Syntax:

<link rel=".." href=" ">


Example:



  <!DOCTYPE html>
  <html>
  <head>
    <link rel="stylesheet" href="styles.css">
  </head>
  <body>
  <h2>This is linked with style sheet</h2>
  <p>Hello world!</p>
  </body>
  </html>


Output:




Our website uses cookies to enhance your experience. Learn More
Accept !

GocourseAI

close
send