Head

HTML

HTML Examples



Html <head>


The <head> element is a container for all the elements of a web page header. Elements inside <head> can include scripts, instruct the browser where to find style sheets, provide meta information, and more.


The following tags can be added to the head section: <title>, <style>, <meta>, <link>, <script>, <noscript>, and <base>.







Html head Elements
































Tag Description
<head>Defines information about Html documents.
<title>Defines document title which displayed at the top of any browser window or browser tabs.
<base>Defines a default address or a default target for all links on a page.
<link>Defines a link or relationship between a document and an external resource.
<meta>Defines metadata about an HTML document.
<script>Defines client side script (javascript, jquery).
<style>Defines style sheet (css) information for a document






Html <title> Elements


The <title> tag specifies the title of the web page.



<title> example

<head>


 <title> Title of the Webpage </title>


<head>









Html <base> Elements


The <base> tag specifies the base URL and target for all relative URLs in a web page.



<base> example

<head>


 <base href="http://www.yourwebsitename.com/images/" target="_blank" />


<head>









Html <link> Elements


The <link> tag defines the relationship between a document and an external resource, most used to link to style sheet.



<link> example

<head>


 <link rel="stylesheet" type="text/css" href="yourstyle.css" />


<head>









Html <meta> Elements


The <meta> tag specify metadata, information about a document rather than document content in a variety of ways. The META element can be used to include name/value pairs describing properties of the Html document, such as author, Expiry Date, a list of keywords, description etc.


Metadata provided by using meta tag is a very important part of the web. It can assist search engines in finding the best match when a user performs a search. Search engines will often look at any metadata attached to a page especially keywords and rank it higher than another page with less relevant metadata, or with no metadata at all.



<meta> example

<head>


 <!--Define keywords for search engines -->


 <meta name="keywords" content="HTML, CSS, PHP, MySql, JavaScript" />


 <!--Define a description of your web page -->


 <meta name="description" content="Online free tutorials" />


 <!--Define the author of a page -->


 <meta name="author" content="Mary Gillen" />


 <!--Refresh document every 10 seconds -->


 <meta http-equiv="refresh" content="10" />


<head>









Html <script> Elements


A script is a small piece of program that can add interactivity to your website. The <script> tag used to defines client side script, such as JavaScript or jQuery. It also include a single external script file in the Html page



Internal <script> example

<head>


 <script type="text/javascript">


   document.write("Hello Javascript!");


 </script>


<head>







External <script> example

<head>


 <script type="text/javascript" src="yourfile.js"> </script>


<head>









Html <style> Elements


The <style> tag used to defines cascading style inside the html page to specify browsers how to render Html elements.



<style> example

<head>


 <style type="text/css">


   body { background-color: #000; }


   p { color: #fff; }


 </style>


<head>