Wednesday, 8 August 2012

Meta Tag Examples:


Specifying Keywords:
We specify keywords which will be used by the search engine to search a web page. So using following tag you can specify important keywords related to your page.
<head>
<meta name=”keywords” content=”HTML, meta tags, metadata” />
</head>

Document Description:
This is again important information and many search engine use this information as well while searching a web page. So you should give an appropriate description of the page.
<head>
<meta name=”description” content=”Learn about Meta Tags.” />
</head>

Document Revision date:
This information tells about last time was updated.
<head>
<meta name=”revised” content=”HTMLLearning, 6/7/2012” />
</head>

Document Refreshing:
You can specify  a duration after which your web page will keep refreshing. If you want your page keep refreshing after every 10 seconds then use the following syntax.
<head>
<meta http-equiv=”refresh” content=”10” />
</head>

Page Redirection:
You can specify a page redirection using Meta Tag. Following is an example of redirecting current page to another page. You can specify a duration after which page will be redirected.
<head>
<meta http-equiv=”refresh” content=”10; url=http://codearms.blogspot.com”/>
</head>

Setting Cookies:
You can use Meta Tag to store cookies on client side later information can be used by then Web Server to track a site visitor.
<head>
<meta http-equiv=”cookie” content=”userid=xyz;
Expires=Wednesday, 08-Aug-2012  23:59:59 GMT;” />
</head>

If you do not include the expirtion date and time, the cookie is considered a session cookie and will be deleted when the user exits the browser.

Setting Author name :
You can set an author name in a web page using Meta Tag.
<head>
<meta name=”author” content=”Codearmster”>
</head>

HTML Meta Tags


HTML lets tou 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, author etc.
The <meta> tag is an empty element and so does not have a closing tag, rather, <meta> tags carry information within attributes, so you need a forward slash character at the end of the element.

Adding Meta Tags to Your Documents:
You can add metadata to your web pages by placing <meta> tags between the <head> and </head> tags. They can include  the following attributes.
Attribute
Description
Name
Name for the property. Can be anything. Examples include, keywords, description, author, revised, generator etc.
Content
Specifies the property’s value.
Scheme
Specifies a scheme to use to interpret the property’s value.
http-equiv
Used for http response message headers. Fro example http-equiv can be used to refresh the page or to set a cookie. Values include content-type, expires, refresh and set-cookie.

The body Element:


The <body> element appears after the <head> element and contains  the part of the web page that you actually see in the main browser window, which is sometimes referred to as body content.
A <body> element may contain anything from a couple of paragraphs under a heading to more complicated layouts  containing forms and tables.

Example:

<body>
     <p>This is a paragraph tag.</p>
</body>



The title Element:


You should specify a title for every page that you write inside the <title> element. This element is a child of the <head> element. It is used in several ways:
·         It displays at the very top of a browser window.
·         It is used as the default name for a bookmark in browsers such as IE and Netscape.
·         Its is used by search engines that use its content to help index pages.
Example:
Here is the example of using title tag.
<head>
<title>HTML Basic Tags</title>
</head>

The head Element:


The <head> element is just a character for all other header elements. It should be the first thing to appear after the opening <html>  tag.
Each <head> element should contain a <title> element indicating the title of the document, although it may also contain any combination of the following elements, in any order:
·         The <base> tag is used to create a “base” url for all links on the page.
·         The <object> tag is designed to include images, Javascript objects, Flash animations, MP3 files, QuickTime movies and other components of a page
·         The <link> tag is used to link to an external file, such as a style sheet or JavaScript file.
·         The <style> tag is used to include CSS rules inside the document.
·         The <script> tag is used to include JAVAScript or VBScript inside the document.
·         The <meta> tag includes information about the document such as keywords and a description, which are particularly helpful for search applications

Example:
<head>
<title>HTML Basic tags</title>
<meta name=”Keywords” content = “HTML, Web Pages” />
<meta name=”description” content = “HTML, Basic Tags” />
<base href=http://www.manish.com />
<link rel=”stylesheet” type =”text/css” href=”tp.css” />
<script type=”text/javascript”>
_uacct = “UA-232293”;
</script>
</head>

The html Element:


The <html> element is the containing element for the whole HTML document. Each HTML document should have one <html> and each document should end with a closing </html> tag.
Following two elements  appear as direct children of an <html> element:
·         <head>
·         <body>

Basic Structure: of HTML


The Basic Structure for all HTML documents is simple and should include the following minimum elements or tags:
·         <html>  -   The main container for HTML pages.
·         <head> -   The container for page  header information.
·         <title>   -   The title of the page.
·         <body> -    The main body of the page.