HTML Head elements

      No Comments on HTML Head elements

This tables demonstrates various HTML Head elements

TagDescription
<head>Defines information about the document
<title>Defines the title of a document
<base>Defines a default address or a default target for all links on a page
<link>Defines the relationship between a document and an external resource
<meta>Defines metadata about an HTML document
<script>Defines a client-side script
<style>Defines style information for a document

Understanding HTML Head elements

The <title> element

The <title> is used to give a title to a web page.

<title> tag gives:

  • title to that web page
  • title of the page in search engine results
  • defines a title inĀ  browser tab

The <meta> element

Meta element specifies metadata like character set, keywords, description, author details and other meta information.

Example:

<head>
  <meta charset="UTF-8">
  <meta name="description" content="Free Code tutorials">
  <meta name="keywords" content="HTML,CSS,JavaScript,Android,PHP,Java">
  <meta name="author" content="Scanfocde">
</head>

The <style> element

The <style> element defines the style information for a HTML page

Example:

<heade>
<style>
.notinpage
{
color:#000;
}
</style>
</head>

The <link> element

The <link> elements links external style sheets to a web page

Example:

<head>
<link rel="stylesheet" href="stylepage.css">
</head>

The <script> element

<script> defines client side javascript

Example:

<head>
<script>
function myfun()
{
alert("hi");
}
</script>
</head>

The<base> element

The element specifies the base URL and base target for all relative URLs in a page

Example:

<base href="http://www.scanfocde.com/pages/" target="_blank">

Leave a Reply

Your email address will not be published. Required fields are marked *